Commit 05c5bb18 authored by Ronny Wichers Schreur's avatar Ronny Wichers Schreur 🏢
Browse files

moved RefCountsInCase and SplitsInCase type definitions from syntax to convertcases

parent 87a4ffb8
...@@ -7,6 +7,8 @@ import syntax, transform ...@@ -7,6 +7,8 @@ import syntax, transform
:: LetVarInfo :: LetVarInfo
:: LetExpressionInfo :: LetExpressionInfo
:: RefCountsInCase
:: SplitsInCase
convertCasesOfFunctions :: !*{! Group} !Int !{# {# FunType} } !{# CommonDefs} !*{#FunDef} !*{#{# CheckedTypeDef}} convertCasesOfFunctions :: !*{! Group} !Int !{# {# FunType} } !{# CommonDefs} !*{#FunDef} !*{#{# CheckedTypeDef}}
!ImportedConstructors !*VarHeap !*TypeHeaps !*ExpressionHeap !ImportedConstructors !*VarHeap !*TypeHeaps !*ExpressionHeap
......
...@@ -141,6 +141,17 @@ convertCasesInBody (TransformedBody body) (Yes type) group_index common_defs cs ...@@ -141,6 +141,17 @@ convertCasesInBody (TransformedBody body) (Yes type) group_index common_defs cs
, plvi_new :: !Bool , 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 :: SymbKind VarInfoPtr ([SymbKind], *VarHeap) -> ([SymbKind], *VarHeap)
checkImportedSymbol symb_kind symb_type_ptr (collected_imports, var_heap) checkImportedSymbol symb_kind symb_type_ptr (collected_imports, var_heap)
# (type_info, var_heap) = readPtr symb_type_ptr var_heap # (type_info, var_heap) = readPtr symb_type_ptr var_heap
...@@ -885,6 +896,27 @@ where ...@@ -885,6 +896,27 @@ where
The actual splitting, the introduction of new functions, and the The actual splitting, the introduction of new functions, and the
introduction of calls to these functions is done in convertRootCases. 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 = :: SplitState =
{ ss_expr_heap :: !.ExpressionHeap { ss_expr_heap :: !.ExpressionHeap
......
...@@ -639,7 +639,8 @@ from convertDynamics import :: TypeCodeVariableInfo, :: DynamicValueAliasInfo ...@@ -639,7 +639,8 @@ from convertDynamics import :: TypeCodeVariableInfo, :: DynamicValueAliasInfo
:: VarInfoPtr :== Ptr VarInfo :: VarInfoPtr :== Ptr VarInfo
from convertcases import :: LetVarInfo, :: LetExpressionInfo from convertcases import :: LetVarInfo, :: LetExpressionInfo,
:: RefCountsInCase, :: SplitsInCase
cNotVarNumber :== -1 cNotVarNumber :== -1
...@@ -781,38 +782,6 @@ cNonRecursiveAppl :== False ...@@ -781,38 +782,6 @@ cNonRecursiveAppl :== False
, aci_safe :: !Bool , 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 = :: UnboundVariable =
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment