diff options
-rw-r--r-- | frontend/convertcases.dcl | 2 | ||||
-rw-r--r-- | frontend/convertcases.icl | 32 | ||||
-rw-r--r-- | frontend/syntax.dcl | 35 |
3 files changed, 36 insertions, 33 deletions
diff --git a/frontend/convertcases.dcl b/frontend/convertcases.dcl index 7c88870..243b5d5 100644 --- a/frontend/convertcases.dcl +++ b/frontend/convertcases.dcl @@ -7,6 +7,8 @@ import syntax, transform :: LetVarInfo :: LetExpressionInfo +:: RefCountsInCase +:: SplitsInCase convertCasesOfFunctions :: !*{! Group} !Int !{# {# FunType} } !{# CommonDefs} !*{#FunDef} !*{#{# CheckedTypeDef}} !ImportedConstructors !*VarHeap !*TypeHeaps !*ExpressionHeap diff --git a/frontend/convertcases.icl b/frontend/convertcases.icl index 0c6fbd7..e55c7f0 100644 --- a/frontend/convertcases.icl +++ b/frontend/convertcases.icl @@ -141,6 +141,17 @@ convertCasesInBody (TransformedBody body) (Yes type) group_index common_defs cs , plvi_new :: !Bool } +:: RefCountsInCase = + { rcc_all_variables :: ![CountedVariable] + , rcc_default_variables :: ![CountedVariable] + , rcc_pattern_variables :: ![[CountedVariable]] + } + +:: CountedVariable = + { cv_variable :: !VarInfoPtr + , cv_count :: !Int + } + checkImportedSymbol :: SymbKind VarInfoPtr ([SymbKind], *VarHeap) -> ([SymbKind], *VarHeap) checkImportedSymbol symb_kind symb_type_ptr (collected_imports, var_heap) # (type_info, var_heap) = readPtr symb_type_ptr var_heap @@ -885,6 +896,27 @@ where The actual splitting, the introduction of new functions, and the introduction of calls to these functions is done in convertRootCases. */ +:: SplitCase = + { sc_alt_nr :: CaseAltNr // the number of the alternative, before which + // the case should be split + , sc_call :: Optional Expression // call to the function that was introduced for + // this split case + } + +:: NextAlt = + { na_case :: ExprInfoPtr // the case_info_ptr of the case + , na_alt_nr :: CaseAltNr // the number of the alternative + } + +:: CaseAltNr :== Int // the sequence number of the alternative (zero based), the + // default alternative is indicated by the number of the last + // alternative + 1 + +:: SplitsInCase = + { sic_next_alt :: Optional NextAlt // the alternative of an outer default, to which + // control should pass + , sic_splits :: [SplitCase] // the positions where this case should be split + } :: SplitState = { ss_expr_heap :: !.ExpressionHeap diff --git a/frontend/syntax.dcl b/frontend/syntax.dcl index 8b873ff..7bcc20c 100644 --- a/frontend/syntax.dcl +++ b/frontend/syntax.dcl @@ -639,7 +639,8 @@ from convertDynamics import :: TypeCodeVariableInfo, :: DynamicValueAliasInfo :: VarInfoPtr :== Ptr VarInfo -from convertcases import :: LetVarInfo, :: LetExpressionInfo +from convertcases import :: LetVarInfo, :: LetExpressionInfo, + :: RefCountsInCase, :: SplitsInCase cNotVarNumber :== -1 @@ -781,38 +782,6 @@ cNonRecursiveAppl :== False , aci_safe :: !Bool } -:: RefCountsInCase = - { rcc_all_variables :: ![CountedVariable] - , rcc_default_variables :: ![CountedVariable] - , rcc_pattern_variables :: ![[CountedVariable]] - } - -:: CountedVariable = - { cv_variable :: !VarInfoPtr - , cv_count :: !Int - } - -:: SplitCase = - { sc_alt_nr :: CaseAltNr // the number of the alternative, before which - // the case should be split - , sc_call :: Optional Expression // call to the function that was introduced for - // this split case - } - -:: NextAlt = - { na_case :: ExprInfoPtr // the case_info_ptr of the case - , na_alt_nr :: CaseAltNr // the number of the alternative - } - -:: CaseAltNr :== Int // the sequence number of the alternative (zero based), the - // default alternative is indicated by the number of the last - // alternative + 1 - -:: SplitsInCase = - { sic_next_alt :: Optional NextAlt // the alternative of an outer default, to which - // control should pass - , sic_splits :: [SplitCase] // the positions where this case should be split - } /* :: UnboundVariable = |