Commit 9a62341a authored by Ronny Wichers Schreur's avatar Ronny Wichers Schreur 🏘
Browse files

removed unnecessary separate fields for universal variables,

they are represented by the TFA constructor for types
parent fa652528
......@@ -282,7 +282,7 @@ where
(type_case_info_ptr, expr_heap) = newPtr EI_Empty expr_heap
(dynamic_info_ptr, expr_heap) = newPtr (EI_DynamicType type opt_dynamics) expr_heap
(act_var, result_expr, expr_heap) = transform_pattern_variable fun_arg opt_var result_expr expr_heap
type_case_patterns = [{ dp_var = var_arg, dp_type = dynamic_info_ptr, dp_rhs = result_expr, dp_type_patterns_vars = [],
type_case_patterns = [{ dp_var = var_arg, dp_type = dynamic_info_ptr, dp_rhs = result_expr,
dp_type_code = TCE_Empty, dp_position = pattern_position }]
= (buildTypeCase act_var type_case_patterns No type_case_info_ptr cCaseNotExplicit, NoPos, var_store, expr_heap, [dynamic_info_ptr], cs)
transform_pattern_into_cases (AP_WildCard _) fun_arg result_expr pattern_position var_store expr_heap opt_dynamics cs
......@@ -830,7 +830,7 @@ where
transform_pattern (AP_Dynamic pattern type opt_var) patterns pattern_scheme pattern_variables defaul result_expr _ var_store expr_heap opt_dynamics cs
# (var_arg, result_expr, _, var_store, expr_heap, opt_dynamics, cs) = convertSubPattern pattern result_expr NoPos var_store expr_heap opt_dynamics cs
(dynamic_info_ptr, expr_heap) = newPtr (EI_DynamicType type opt_dynamics) expr_heap
pattern = { dp_var = var_arg, dp_type = dynamic_info_ptr, dp_rhs = result_expr, dp_type_patterns_vars = [],
pattern = { dp_var = var_arg, dp_type = dynamic_info_ptr, dp_rhs = result_expr,
dp_type_code = TCE_Empty, dp_position = NoPos }
pattern_variables = cons_optional opt_var pattern_variables
= case pattern_scheme of
......@@ -1736,7 +1736,7 @@ convertSubPattern (AP_Dynamic pattern type opt_var) result_expr pattern_position
(var_expr_ptr, expr_heap) = newPtr EI_Empty expr_heap
(type_case_info_ptr, expr_heap) = newPtr EI_Empty expr_heap
(dynamic_info_ptr, expr_heap) = newPtr (EI_DynamicType type opt_dynamics) expr_heap
type_case_patterns = [{ dp_var = var_arg, dp_type = dynamic_info_ptr, dp_rhs = result_expr, dp_type_patterns_vars = [],
type_case_patterns = [{ dp_var = var_arg, dp_type = dynamic_info_ptr, dp_rhs = result_expr,
dp_type_code = TCE_Empty, dp_position = pattern_position }]
= ({ fv_ident = bind_src, fv_info_ptr = bind_dst, fv_def_level = NotALevel, fv_count = 0 },
buildTypeCase (Var { var_ident = bind_src, var_info_ptr = bind_dst, var_expr_ptr = var_expr_ptr })
......
......@@ -1177,24 +1177,24 @@ where
(uni_vars, (type_var_heap, var_heap)) = newTypeVariables dt_uni_vars (type_var_heap, var_heap)
(type_code_expr, (type_code_info,var_heap,error)) = toTypeCodeExpression (add_universal_vars_to_type dt_uni_vars dt_type)
({ type_code_info & tci_type_var_heap = type_var_heap }, var_heap, error)
expr_heap = expr_heap <:= (dyn_ptr, EI_TypeOfDynamic uni_vars type_code_expr)
expr_heap = expr_heap <:= (dyn_ptr, EI_TypeOfDynamic type_code_expr)
-> convert_local_dynamics loc_dynamics (type_code_info, expr_heap, type_pattern_vars, var_heap, error)
EI_Empty
# (uni_vars, (type_var_heap, var_heap)) = newTypeVariables dt_uni_vars (type_code_info.tci_type_var_heap, var_heap)
(type_code_expr, (type_code_info,var_heap,error)) = toTypeCodeExpression (add_universal_vars_to_type dt_uni_vars dt_type)
({ type_code_info & tci_type_var_heap = type_var_heap }, var_heap, error)
expr_heap = expr_heap <:= (dyn_ptr, EI_TypeOfDynamic uni_vars type_code_expr)
expr_heap = expr_heap <:= (dyn_ptr, EI_TypeOfDynamic type_code_expr)
-> convert_local_dynamics loc_dynamics (type_code_info, expr_heap, type_pattern_vars, var_heap, error)
EI_TempDynamicType No loc_dynamics _ _ expr_ptr {symb_ident}
# (expr_info, expr_heap) = readPtr expr_ptr expr_heap
-> case expr_info of
EI_TypeCode type_expr
# (type_expr, (var_heap, error)) = updateFreeVarsOfTCE symb_ident type_expr (var_heap, error)
expr_heap = expr_heap <:= (dyn_ptr, EI_TypeOfDynamic [] type_expr)
expr_heap = expr_heap <:= (dyn_ptr, EI_TypeOfDynamic type_expr)
-> convert_local_dynamics loc_dynamics (type_code_info, expr_heap, type_pattern_vars, var_heap, error)
EI_Selection selectors record_var _
# (_, var_info_ptr, var_heap, error) = getClassVariable symb_ident record_var var_heap error
expr_heap = expr_heap <:= (dyn_ptr, EI_TypeOfDynamic [] (convert_selectors selectors var_info_ptr))
expr_heap = expr_heap <:= (dyn_ptr, EI_TypeOfDynamic (convert_selectors selectors var_info_ptr))
-> convert_local_dynamics loc_dynamics (type_code_info, expr_heap, type_pattern_vars, var_heap, error)
EI_TempDynamicPattern type_vars {dt_global_vars, dt_uni_vars, dt_type} loc_dynamics temp_local_vars _ _ expr_ptr {symb_ident}
# (expr_info, expr_heap) = readPtr expr_ptr expr_heap
......@@ -1525,7 +1525,7 @@ where
// otherwise
= ui
# ui = {ui & ui_has_type_codes=ui_has_type_codes}
(EI_TypeOfDynamic uni_vars type_code, ui_symbol_heap) = readPtr dyn_info_ptr ui.ui_symbol_heap
(EI_TypeOfDynamic type_code, ui_symbol_heap) = readPtr dyn_info_ptr ui.ui_symbol_heap
ui = { ui & ui_symbol_heap = ui_symbol_heap }
= (DynamicExpr { dyn & dyn_expr = dyn_expr, dyn_type_code = type_code }, ui)
updateExpression group_index (MatchExpr cons_symbol expr) ui
......@@ -1613,7 +1613,7 @@ where
updateExpression group_index dp=:{dp_type,dp_rhs} ui
# (dp_rhs, ui) = updateExpression group_index dp_rhs ui
(EI_TypeOfDynamicPattern type_pattern_vars type_code, ui_symbol_heap) = readPtr dp_type ui.ui_symbol_heap
= ({ dp & dp_rhs = dp_rhs, dp_type_patterns_vars = type_pattern_vars, dp_type_code = type_code }, { ui & ui_symbol_heap = ui_symbol_heap })
= ({ dp & dp_rhs = dp_rhs, dp_type_code = type_code }, { ui & ui_symbol_heap = ui_symbol_heap })
instance updateExpression (a,b) | updateExpression a & updateExpression b
where
......
......@@ -749,7 +749,7 @@ cNonRecursiveAppl :== False
| EI_TempDynamicType !(Optional DynamicType) ![DynamicPtr] !AType ![TypeContext] !ExprInfoPtr !SymbIdent
| EI_TempDynamicPattern ![TypeVar] !DynamicType ![DynamicPtr] ![TempLocalVar] !AType ![TypeContext] !ExprInfoPtr !SymbIdent
| EI_TypeOfDynamic ![VarInfoPtr] !TypeCodeExpression /* Final */
| EI_TypeOfDynamic !TypeCodeExpression /* Final */
| EI_TypeOfDynamicPattern ![VarInfoPtr] !TypeCodeExpression /* Final */
| EI_TypeCode !TypeCodeExpression
......@@ -1310,7 +1310,6 @@ instance == OverloadedListType
:: DynamicPattern =
{ dp_var :: !FreeVar
, dp_type :: !ExprInfoPtr
, dp_type_patterns_vars :: ![VarInfoPtr] /* filled after type checking */
, dp_type_code :: !TypeCodeExpression /* filled after type checking */
, dp_rhs :: !Expression
, dp_position :: !Position
......
......@@ -414,8 +414,8 @@ where
instance <<< DynamicPattern
where
(<<<) file {dp_type_patterns_vars,dp_var,dp_rhs,dp_type_code}
= writeVarPtrs (file <<< dp_var <<< " :: ") dp_type_patterns_vars <<< dp_type_code <<< " = " <<< dp_rhs
(<<<) file {dp_var,dp_rhs,dp_type_code}
= file <<< dp_var <<< " :: " <<< dp_type_code <<< " = " <<< dp_rhs
writeVarPtrs file []
= file
......@@ -425,8 +425,7 @@ writeVarPtrs file vars
write_var_ptrs file [var]
= file <<< var
write_var_ptrs file [var : vars]
= write_var_ptrs (file <<< var <<< '.') vars
= write_var_ptrs (file <<< var <<< '.') vars
instance <<< TypeCodeExpression
where
......
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