Commit 86aecc2c authored by John van Groningen's avatar John van Groningen

make CheckStateX in CheckState unique if CheckState is unique

parent b435ead0
......@@ -506,9 +506,9 @@ where
make_class_member_instance_type :: InstanceType SymbolType [TypeVar] z:{#CheckedTypeDef} u:{#DclModule} *VarHeap *TypeHeaps *CheckState
-> *(!SymbolType,!z:{#CheckedTypeDef},!u:{#DclModule},!*VarHeap,!*TypeHeaps,!*CheckState)
make_class_member_instance_type ins_type me_type me_class_vars type_defs modules var_heap type_heaps cs
make_class_member_instance_type ins_type me_type me_class_vars type_defs modules var_heap type_heaps cs=:{cs_x={x_main_dcl_module_n}}
# (instance_type, _, type_heaps, Yes (modules, type_defs), cs_error)
= determineTypeOfMemberInstance me_type me_class_vars ins_type SP_None type_heaps (Yes (modules, type_defs, cs.cs_x.x_main_dcl_module_n)) cs.cs_error
= determineTypeOfMemberInstance me_type me_class_vars ins_type SP_None type_heaps (Yes (modules, type_defs, x_main_dcl_module_n)) cs.cs_error
cs = {cs & cs_error = cs_error }
(st_context, var_heap) = initializeContextVariables instance_type.st_context var_heap
instance_type = { instance_type & st_context = st_context }
......@@ -1872,7 +1872,7 @@ replace_icl_macros_by_dcl_macros _ {ir_from=first_icl_macro_index,ir_to=end_icl_
checkDclModules :: [Import] *{#DclModule} *{#*{#FunDef}} *Heaps *CheckState
-> (Int,[ExplicitImport],.[{#Char}],ExplImpInfos, *{#DclModule},*{#*{#FunDef}},*Heaps,*CheckState)
checkDclModules imports_of_icl_mod dcl_modules macro_defs heaps cs=:{cs_symbol_table}
checkDclModules imports_of_icl_mod dcl_modules macro_defs heaps cs=:{cs_symbol_table,cs_x={x_main_dcl_module_n}}
#! nr_of_dcl_modules = size dcl_modules
# (bitvect, dependencies, dcl_modules, cs_symbol_table)
= iFoldSt add_dependencies 0 nr_of_dcl_modules
......@@ -1885,7 +1885,7 @@ checkDclModules imports_of_icl_mod dcl_modules macro_defs heaps cs=:{cs_symbol_t
dependencies_of_icl_mod dcl_modules
dependencies = { dependencies & [index_of_icl_module] = dependencies_of_icl_mod }
module_dag = { dag_nr_of_nodes = nr_of_dcl_modules+1, dag_get_children = select dependencies }
components = partitionateDAG module_dag [cs.cs_x.x_main_dcl_module_n,index_of_icl_module]
components = partitionateDAG module_dag [x_main_dcl_module_n,index_of_icl_module]
// | False--->("biggest component:", m axList (map length components))
// = undef
# (nr_of_components, component_numbers)
......@@ -2637,7 +2637,7 @@ check_module1 cdefs icl_global_function_range fun_defs optional_dcl_mod optional
add_predef_module_and_modules_to_symbol_table No modules mod_index cs
= add_modules_to_symbol_table modules mod_index cs
add_modules_to_symbol_table [] mod_index cs=:{cs_predef_symbols,cs_symbol_table,cs_x}
add_modules_to_symbol_table [] mod_index cs=:{cs_predef_symbols,cs_symbol_table,cs_x={x_main_dcl_module_n}}
# (cs_predef_symbols, cs_symbol_table) = (cs_predef_symbols, cs_symbol_table)
<=< adjust_predefined_module_symbol PD_StdArray
<=< adjust_predefined_module_symbol PD_StdEnum
......@@ -2656,7 +2656,7 @@ check_module1 cdefs icl_global_function_range fun_defs optional_dcl_mod optional
# (mod_entry, symbol_table) = readPtr predefined_idents.[predef_index].id_info symbol_table
= case mod_entry.ste_kind of
STE_Module _
-> ({pre_def_symbols & [predef_index] = {mod_symb & pds_module = cs_x.x_main_dcl_module_n, pds_def = mod_entry.ste_index}}, symbol_table)
-> ({pre_def_symbols & [predef_index] = {mod_symb & pds_module = x_main_dcl_module_n, pds_def = mod_entry.ste_index}}, symbol_table)
_
-> (pre_def_symbols, symbol_table)
......@@ -2962,13 +2962,14 @@ check_module2 mod_ident mod_modification_time mod_imported_objects mod_imports m
icl_used_module_numbers = imported_module_numbers, icl_modification_time = mod_modification_time }
= (False, icl_mod, dcl_modules, {}, {}, cs_x.x_main_dcl_module_n,heaps, cs_predef_symbols, cs_symbol_table, cs_error.ea_file, directly_imported_dcl_modules)
where
check_start_rule mod_kind mod_ident icl_global_functions_ranges cs=:{cs_symbol_table,cs_x}
check_start_rule mod_kind mod_ident icl_global_functions_ranges cs=:{cs_symbol_table}
# ({ste_kind, ste_index}, cs_symbol_table) = readPtr predefined_idents.[PD_Start].id_info cs_symbol_table
cs = { cs & cs_symbol_table = cs_symbol_table }
= case ste_kind of
STE_FunctionOrMacro _
| index_in_ranges ste_index icl_global_functions_ranges
-> { cs & cs_predef_symbols.[PD_Start] = { pds_def = ste_index, pds_module = cs_x.x_main_dcl_module_n }}
#! main_dcl_module_n = cs.cs_x.x_main_dcl_module_n
-> { cs & cs_predef_symbols.[PD_Start] = { pds_def = ste_index, pds_module = main_dcl_module_n }}
where
index_in_ranges index [{ir_from, ir_to}:ranges]
= (index>=ir_from && index < ir_to) || index_in_ranges index ranges;
......
......@@ -62,13 +62,13 @@ cCaseNotExplicit :== False
:: RecordKind = RK_Constructor | RK_Update
get_unboxed_list_indices_and_decons_u_symb_ident :: *CheckState -> (!Index,!Index,!Index,!SymbIdent,!*CheckState)
get_unboxed_list_indices_and_decons_u_symb_ident cs=:{cs_predef_symbols,cs_x}
get_unboxed_list_indices_and_decons_u_symb_ident cs=:{cs_predef_symbols,cs_x=cs_x=:{x_needed_modules}}
# (stdStrictLists_index,cs_predef_symbols)=cs_predef_symbols![PD_StdStrictLists].pds_def
(nil_u_index,cs_predef_symbols)=cs_predef_symbols![PD_nil_u].pds_def
(decons_u_index,cs_predef_symbols)=cs_predef_symbols![PD_decons_u].pds_def
decons_u_ident = predefined_idents.[PD_decons_u]
app_symb = {symb_ident=decons_u_ident,symb_kind=SK_OverloadedFunction {glob_object=decons_u_index,glob_module=stdStrictLists_index}}
cs & cs_predef_symbols=cs_predef_symbols,cs_x.x_needed_modules=cs_x.x_needed_modules bitor cNeedStdStrictLists
cs & cs_predef_symbols=cs_predef_symbols,cs_x={cs_x & x_needed_modules=x_needed_modules bitor cNeedStdStrictLists}
= (stdStrictLists_index,decons_u_index,nil_u_index,app_symb,cs)
make_unboxed_list expr_heap cs
......@@ -79,13 +79,13 @@ make_unboxed_list expr_heap cs
= (unboxed_list,decons_expr,expr_heap,cs)
get_unboxed_tail_strict_list_indices_and_decons_uts_symb_ident :: *CheckState -> (!Index,!Index,!Index,!SymbIdent,!*CheckState)
get_unboxed_tail_strict_list_indices_and_decons_uts_symb_ident cs=:{cs_predef_symbols,cs_x}
get_unboxed_tail_strict_list_indices_and_decons_uts_symb_ident cs=:{cs_predef_symbols,cs_x=cs_x=:{x_needed_modules}}
# (stdStrictLists_index,cs_predef_symbols)=cs_predef_symbols![PD_StdStrictLists].pds_def
(nil_uts_index,cs_predef_symbols)=cs_predef_symbols![PD_nil_uts].pds_def
(decons_uts_index,cs_predef_symbols)=cs_predef_symbols![PD_decons_uts].pds_def
decons_uts_ident = predefined_idents.[PD_decons_uts]
app_symb = {symb_ident=decons_uts_ident,symb_kind=SK_OverloadedFunction {glob_object=decons_uts_index,glob_module=stdStrictLists_index}}
cs & cs_predef_symbols=cs_predef_symbols,cs_x.x_needed_modules=cs_x.x_needed_modules bitor cNeedStdStrictLists
cs & cs_predef_symbols=cs_predef_symbols,cs_x={cs_x & x_needed_modules=x_needed_modules bitor cNeedStdStrictLists}
= (stdStrictLists_index,decons_uts_index,nil_uts_index,app_symb,cs)
make_unboxed_tail_strict_list expr_heap cs
......@@ -96,13 +96,13 @@ make_unboxed_tail_strict_list expr_heap cs
= (unboxed_list,decons_expr,expr_heap,cs)
get_overloaded_list_indices_and_decons_symb_ident :: *CheckState -> (!Index,!Index,!Index,!SymbIdent,!*CheckState)
get_overloaded_list_indices_and_decons_symb_ident cs=:{cs_predef_symbols,cs_x}
get_overloaded_list_indices_and_decons_symb_ident cs=:{cs_predef_symbols,cs_x=cs_x=:{x_needed_modules}}
# (stdStrictLists_index,cs_predef_symbols)=cs_predef_symbols![PD_StdStrictLists].pds_def
(nil_index,cs_predef_symbols)=cs_predef_symbols![PD_nil].pds_def
(decons_index,cs_predef_symbols)=cs_predef_symbols![PD_decons].pds_def
decons_ident = predefined_idents.[PD_decons]
app_symb = {symb_ident=decons_ident,symb_kind=SK_OverloadedFunction {glob_object=decons_index,glob_module=stdStrictLists_index}}
cs & cs_predef_symbols=cs_predef_symbols,cs_x.x_needed_modules=cs_x.x_needed_modules bitor cNeedStdStrictLists
cs & cs_predef_symbols=cs_predef_symbols,cs_x={cs_x & x_needed_modules=x_needed_modules bitor cNeedStdStrictLists}
= (stdStrictLists_index,decons_index,nil_index,app_symb,cs)
make_overloaded_list expr_heap cs
......@@ -113,13 +113,13 @@ make_overloaded_list expr_heap cs
= (overloaded_list,decons_expr,expr_heap,cs)
get_unboxed_maybe_indices_and_from_just_u_symb_ident :: *CheckState -> (!Index,!Index,!Index,!SymbIdent,!*CheckState)
get_unboxed_maybe_indices_and_from_just_u_symb_ident cs=:{cs_predef_symbols,cs_x}
get_unboxed_maybe_indices_and_from_just_u_symb_ident cs=:{cs_predef_symbols,cs_x=cs_x=:{x_needed_modules}}
# (stdStrictMaybes_index,cs_predef_symbols)=cs_predef_symbols![PD_StdStrictMaybes].pds_def
(nothing_u_index,cs_predef_symbols)=cs_predef_symbols![PD_nothing_u].pds_def
(from_just_u_index,cs_predef_symbols)=cs_predef_symbols![PD_from_just_u].pds_def
from_just_u_ident = predefined_idents.[PD_from_just_u]
app_symb = {symb_ident=from_just_u_ident,symb_kind=SK_OverloadedFunction {glob_object=from_just_u_index,glob_module=stdStrictMaybes_index}}
cs & cs_predef_symbols=cs_predef_symbols,cs_x.x_needed_modules=cs_x.x_needed_modules bitor cNeedStdStrictMaybes
cs & cs_predef_symbols=cs_predef_symbols,cs_x={cs_x & x_needed_modules=x_needed_modules bitor cNeedStdStrictMaybes}
= (stdStrictMaybes_index,from_just_u_index,nothing_u_index,app_symb,cs)
make_unboxed_maybe expr_heap cs
......@@ -130,13 +130,13 @@ make_unboxed_maybe expr_heap cs
= (unboxed_maybe,decons_expr,expr_heap,cs)
get_overloaded_maybe_indices_and_from_just_symb_ident :: *CheckState -> (!Index,!Index,!Index,!SymbIdent,!*CheckState)
get_overloaded_maybe_indices_and_from_just_symb_ident cs=:{cs_predef_symbols,cs_x}
get_overloaded_maybe_indices_and_from_just_symb_ident cs=:{cs_predef_symbols,cs_x=cs_x=:{x_needed_modules}}
# (stdStrictMaybes_index,cs_predef_symbols)=cs_predef_symbols![PD_StdStrictMaybes].pds_def
(nothing_index,cs_predef_symbols)=cs_predef_symbols![PD_nothing].pds_def
(from_just_index,cs_predef_symbols)=cs_predef_symbols![PD_from_just].pds_def
from_just_ident = predefined_idents.[PD_from_just]
app_symb = {symb_ident=from_just_ident,symb_kind=SK_OverloadedFunction {glob_object=from_just_index,glob_module=stdStrictMaybes_index}}
cs & cs_predef_symbols=cs_predef_symbols,cs_x.x_needed_modules=cs_x.x_needed_modules bitor cNeedStdStrictMaybes
cs & cs_predef_symbols=cs_predef_symbols,cs_x={cs_x & x_needed_modules=x_needed_modules bitor cNeedStdStrictMaybes}
= (stdStrictMaybes_index,from_just_index,nothing_index,app_symb,cs)
make_overloaded_maybe expr_heap cs
......@@ -906,13 +906,13 @@ checkExpression free_vars (PE_Generic id=:{id_name,id_info} kind) e_input e_stat
check_generic_expr free_vars entry id kind e_input e_state e_info cs=:{cs_error}
= (EE, free_vars, e_state, e_info, { cs & cs_error = checkError id "not a generic" cs_error })
check_it free_vars mod_index gen_index id kind e_input e_state=:{es_expr_heap} e_info cs
check_it free_vars mod_index gen_index id kind e_input e_state=:{es_expr_heap} e_info cs=:{cs_x=cs_x=:{x_needed_modules}}
#! symb_kind = SK_Generic {glob_object = gen_index, glob_module = mod_index} kind
#! symbol = { symb_ident = id, symb_kind = symb_kind }
#! (new_info_ptr, es_expr_heap) = newPtr EI_Empty es_expr_heap
#! app = { app_symb = symbol, app_args = [], app_info_ptr = new_info_ptr }
#! e_state = { e_state & es_expr_heap = es_expr_heap }
#! cs = { cs & cs_x.x_needed_modules = cs.cs_x.x_needed_modules bitor cNeedStdGeneric }
#! cs & cs_x={cs_x & x_needed_modules = x_needed_modules bitor cNeedStdGeneric}
= (App app, free_vars, e_state, e_info, cs)
checkExpression free_vars (PE_TypeSignature array_kind expr) e_input e_state e_info cs
# (expr,free_vars,e_state,e_info,cs) = checkExpression free_vars expr e_input e_state e_info cs
......@@ -1399,14 +1399,14 @@ checkIdentExpression is_expr_list free_vars id=:{id_info} e_input e_state e_info
where
check_id_expression :: !SymbolTableEntry !Bool ![FreeVar] !Ident !ExpressionInput !*ExpressionState !u:ExpressionInfo !*CheckState
-> (!Expression, ![FreeVar], !*ExpressionState,!u:ExpressionInfo,!*CheckState)
check_id_expression {ste_kind = STE_Empty} is_expr_list free_vars id e_input e_state e_info cs=:{cs_error,cs_predef_symbols,cs_x}
check_id_expression {ste_kind = STE_Empty} is_expr_list free_vars id e_input e_state e_info cs=:{cs_error,cs_predef_symbols,cs_x=cs_x=:{x_needed_modules}}
# local_predefined_idents = predefined_idents
# from_ident = local_predefined_idents.[PD_From]
from_then_ident = local_predefined_idents.[PD_FromThen]
from_to_ident = local_predefined_idents.[PD_FromTo]
from_then_to_ident = local_predefined_idents.[PD_FromThenTo]
| id==from_ident || id==from_then_ident || id==from_to_ident || id==from_then_to_ident
= (EE, free_vars, e_state, e_info, { cs & cs_x.x_needed_modules = cs_x.x_needed_modules bitor cStdEnumImportMissing})
= (EE, free_vars, e_state, e_info, {cs & cs_x={cs_x & x_needed_modules = x_needed_modules bitor cStdEnumImportMissing}})
// instead of giving an error message remember that StdEnum should have been imported.
// Error will be given in function check_needed_modules_are_imported
| id==local_predefined_idents.[PD_FromS] || id==local_predefined_idents.[PD_FromTS] || id==local_predefined_idents.[PD_FromSTS]
......@@ -1417,25 +1417,25 @@ where
|| id==local_predefined_idents.[PD_FromToU] || id==local_predefined_idents.[PD_FromToUTS] || id==local_predefined_idents.[PD_FromToO]
|| id==local_predefined_idents.[PD_FromThenToS] || id==local_predefined_idents.[PD_FromThenToTS] || id==local_predefined_idents.[PD_FromThenToSTS]
|| id==local_predefined_idents.[PD_FromThenToU] || id==local_predefined_idents.[PD_FromThenToUTS] || id==local_predefined_idents.[PD_FromThenToO]
= (EE, free_vars, e_state, e_info, {cs & cs_x.x_needed_modules = cs_x.x_needed_modules bitor c_SystemEnumStrictImportMissing})
= (EE, free_vars, e_state, e_info, {cs & cs_x={cs_x & x_needed_modules = x_needed_modules bitor c_SystemEnumStrictImportMissing}})
# createArray_ident = local_predefined_idents.[PD__CreateArrayFun]
uselect_ident = local_predefined_idents.[PD_UnqArraySelectFun]
update_ident = local_predefined_idents.[PD_ArrayUpdateFun]
usize_ident = local_predefined_idents.[PD_UnqArraySizeFun]
| id==createArray_ident || id==uselect_ident || id==update_ident || id==usize_ident
= (EE, free_vars, e_state, e_info, { cs & cs_x.x_needed_modules = cs_x.x_needed_modules bitor cStdArrayImportMissing})
= (EE, free_vars, e_state, e_info, {cs & cs_x={cs_x & x_needed_modules = x_needed_modules bitor cStdArrayImportMissing}})
// instead of giving an error message remember that StdArray should have been be imported.
// Error will be given in function check_needed_modules_are_imported
| id==local_predefined_idents.[PD_cons] || id==local_predefined_idents.[PD_decons]
|| id==local_predefined_idents.[PD_cons_u] || id==local_predefined_idents.[PD_decons_u]
|| id==local_predefined_idents.[PD_cons_uts] || id==local_predefined_idents.[PD_decons_uts]
|| id==local_predefined_idents.[PD_nil] || id==local_predefined_idents.[PD_nil_u] || id==local_predefined_idents.[PD_nil_uts]
= (EE, free_vars, e_state, e_info, { cs & cs_x.x_needed_modules = cs_x.x_needed_modules bitor cNeedStdStrictLists})
= (EE, free_vars, e_state, e_info, {cs & cs_x={cs_x & x_needed_modules = x_needed_modules bitor cNeedStdStrictLists}})
// instead report that StdStrictLists should be imported in function check_needed_modules_are_imported
| id==local_predefined_idents.[PD_just] || id==local_predefined_idents.[PD_from_just]
|| id==local_predefined_idents.[PD_just_u] || id==local_predefined_idents.[PD_from_just_u]
|| id==local_predefined_idents.[PD_nothing] || id==local_predefined_idents.[PD_nothing_u]
= (EE, free_vars, e_state, e_info, {cs & cs_x.x_needed_modules = cs_x.x_needed_modules bitor cNeedStdStrictMaybes})
= (EE, free_vars, e_state, e_info, {cs & cs_x={cs_x & x_needed_modules = x_needed_modules bitor cNeedStdStrictMaybes}})
// instead report that cNeedStdStrictMaybes should be imported in function check_needed_modules_are_imported
= (EE, free_vars, e_state, e_info, { cs & cs_error = checkError id "undefined" cs_error })
check_id_expression {ste_kind = STE_Variable info_ptr,ste_def_level} is_expr_list free_vars id e_input=:{ei_fun_level} e_state=:{es_expr_heap} e_info cs
......@@ -1477,10 +1477,10 @@ where
determine_info_of_symbol :: !SymbolTableEntry !SymbolPtr !ExpressionInput !*ExpressionState !u:ExpressionInfo !*CheckState
-> (!SymbKind, !Int, !Priority, !*ExpressionState, !u:ExpressionInfo,!*CheckState)
determine_info_of_symbol entry=:{ste_kind=STE_FunctionOrMacro calls,ste_index,ste_def_level} symb_info
e_input=:{ei_fun_index} e_state=:{es_calls} e_info cs=:{cs_symbol_table,cs_x}
e_input=:{ei_fun_index} e_state=:{es_calls} e_info cs=:{cs_symbol_table,cs_x={x_main_dcl_module_n}}
# (fun_def,e_state) = e_state!es_fun_defs.[ste_index]
# {fun_arity,fun_kind,fun_priority,fun_info={fi_properties}}=fun_def
# index = { glob_object = ste_index, glob_module = cs_x.x_main_dcl_module_n }
# index = { glob_object = ste_index, glob_module = x_main_dcl_module_n }
# symbol_kind = convert_DefOrImpFunKind_to_icl_SymbKind fun_kind index fi_properties
| is_called_before ei_fun_index calls
= (symbol_kind, fun_arity, fun_priority, e_state, e_info, cs)
......
......@@ -27,7 +27,7 @@ cNeedStdStrictMaybes :== 64
:: ErrorAdmin = { ea_file :: !.File, ea_loc :: ![IdentPos], ea_ok :: !Bool }
:: CheckState = { cs_symbol_table :: !.SymbolTable, cs_predef_symbols :: !.PredefinedSymbols, cs_error :: !.ErrorAdmin,cs_x :: !CheckStateX }
:: CheckState = { cs_symbol_table :: !.SymbolTable, cs_predef_symbols :: !.PredefinedSymbols, cs_error :: !.ErrorAdmin,cs_x :: !.CheckStateX }
:: CheckStateX = {x_needed_modules :: !BITVECT,x_main_dcl_module_n :: !Int, x_check_dynamic_types :: !Bool }
......
......@@ -575,7 +575,7 @@ get_eei_ident (eii=:ExplImpInfo eii_ident _) = (eii_ident, eii)
checkExplicitImportCompleteness :: ![([Declaration], Position)] ![([Declaration], Int)]
!*{#DclModule} !*{#*{#FunDef}} !*ExpressionHeap !*CheckState
-> (!.{#DclModule},!*{#*{#FunDef}},!.ExpressionHeap,!.CheckState)
checkExplicitImportCompleteness dcls_explicit explicit_qualified_imports dcl_modules macro_defs expr_heap cs=:{cs_symbol_table, cs_error}
checkExplicitImportCompleteness dcls_explicit explicit_qualified_imports dcl_modules macro_defs expr_heap cs=:{cs_symbol_table,cs_error,cs_x={x_main_dcl_module_n}}
#! n_dcl_modules = size dcl_modules
# (modified_symbol_ptrs,cs_symbol_table) = store_qualified_explicitly_imported_symbols_in_symbol_table explicit_qualified_imports [] cs_symbol_table
......@@ -584,10 +584,9 @@ checkExplicitImportCompleteness dcls_explicit explicit_qualified_imports dcl_mod
ccs_set_of_visited_macros = { {} \\ module_n<-[0..n_dcl_modules-1]},
ccs_expr_heap = expr_heap, ccs_symbol_table = cs_symbol_table,
ccs_error = cs_error, ccs_heap_changes_accu = modified_symbol_ptrs }
main_dcl_module_n = cs.cs_x.x_main_dcl_module_n
ccs = foldSt (\(dcls, position) ccs
-> foldSt (checkCompleteness main_dcl_module_n position) dcls ccs)
-> foldSt (checkCompleteness x_main_dcl_module_n position) dcls ccs)
dcls_explicit
{ box_ccs = box_ccs }
{ ccs_dcl_modules, ccs_macro_defs,ccs_expr_heap, ccs_symbol_table, ccs_error, ccs_heap_changes_accu } = ccs.box_ccs
......
Markdown is supported
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