diff options
author | ronny | 2001-05-08 09:58:19 +0000 |
---|---|---|
committer | ronny | 2001-05-08 09:58:19 +0000 |
commit | 202e6247667451a500c54a36984d92f525c0ef11 (patch) | |
tree | 2cefddc97c0a7f973ec044244fc1f495768e9f72 | |
parent | added VI_Labelled_Empty and VI_LocalLetVar to VarInfo (diff) |
support for cases in backend
git-svn-id: https://svn.cs.ru.nl/repos/clean-compiler/trunk@394 1f8540f1-abd5-4d5b-9d24-4c5ce8603e2d
-rw-r--r-- | backend/backendpreprocess.icl | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/backend/backendpreprocess.icl b/backend/backendpreprocess.icl index 8b0dd8c..6000de6 100644 --- a/backend/backendpreprocess.icl +++ b/backend/backendpreprocess.icl @@ -72,9 +72,18 @@ instance sequence (Optional a) | sequence a where instance sequence FunctionBody where sequence (BackendBody backEndBodies) = sequence backEndBodies + sequence (TransformedBody transformedBody) + = sequence transformedBody sequence body = abort "preprocess (FunctionBody): unknown body" <<- body +// case test ... +instance sequence TransformedBody where + sequence body + = sequence body.tb_args + o` sequence body.tb_rhs +// ... case test + instance sequence BackendBody where sequence body = sequence body.bb_args @@ -102,9 +111,32 @@ instance sequence Expression where o` sequence selections sequence (AnyCodeExpr _ outParams _) = foldState (\{bind_dst}->sequence bind_dst) outParams + sequence (Case caseExpr) + = sequence caseExpr sequence _ = identity +instance sequence Case where + sequence {case_expr, case_guards, case_default} + = sequence case_expr + o` sequence case_guards + o` sequence case_default + +instance sequence CasePatterns where + sequence (AlgebraicPatterns _ patterns) + = sequence patterns + sequence (BasicPatterns _ patterns) + = sequence patterns + +instance sequence AlgebraicPattern where + sequence {ap_vars, ap_expr} + = sequence ap_vars + o` sequence ap_expr + +instance sequence BasicPattern where + sequence {bp_expr} + = sequence bp_expr + instance sequence Selection where sequence (RecordSelection _ _) = identity |