Commit a5d7a2a5 authored by John van Groningen's avatar John van Groningen
Browse files

allow qualified imports of class members

parent cf4ee7db
...@@ -3,7 +3,7 @@ implementation module check ...@@ -3,7 +3,7 @@ implementation module check
import StdEnv import StdEnv
import syntax, typesupport, parse, checksupport, utilities, checktypes, transform, predef import syntax, typesupport, parse, checksupport, utilities, checktypes, transform, predef
import explicitimports, comparedefimp, checkFunctionBodies, containers, compilerSwitches import explicitimports, comparedefimp, checkFunctionBodies, containers
import genericsupport import genericsupport
import typereify import typereify
from checkgenerics import checkGenericDefs,checkGenericCaseDefs,convert_generic_instances,create_gencase_funtypes from checkgenerics import checkGenericDefs,checkGenericCaseDefs,convert_generic_instances,create_gencase_funtypes
...@@ -938,7 +938,7 @@ createCommonDefinitions {def_types,def_constructors,def_selectors,def_classes,de ...@@ -938,7 +938,7 @@ createCommonDefinitions {def_types,def_constructors,def_selectors,def_classes,de
, com_member_defs = { member \\ member <- def_members } , com_member_defs = { member \\ member <- def_members }
, com_instance_defs = { next_instance \\ next_instance <- def_instances } , com_instance_defs = { next_instance \\ next_instance <- def_instances }
, com_generic_defs = { gen \\ gen <- def_generics } , com_generic_defs = { gen \\ gen <- def_generics }
, com_gencase_defs = { gi \\ gi <- def_generic_cases} , com_gencase_defs = { gi \\ gi <- def_generic_cases}
} }
array_plus_list a [] = a array_plus_list a [] = a
...@@ -1468,8 +1468,8 @@ replace_icl_macros_by_dcl_macros _ {ir_from=first_icl_macro_index,ir_to=end_icl_ ...@@ -1468,8 +1468,8 @@ replace_icl_macros_by_dcl_macros _ {ir_from=first_icl_macro_index,ir_to=end_icl_
(<=<) infixl (<=<) infixl
(<=<) state fun :== fun state (<=<) state fun :== fun state
checkDclModules :: [Import] *{#DclModule} *{#*{#FunDef}} *Heaps *CheckState checkDclModules :: [Import] *{#DclModule} *{#*{#FunDef}} *Heaps *CheckState
-> (Int,[ExplicitImport],.[{#Char}],{!{!.ExplImpInfo}}, *{#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}
#! nr_of_dcl_modules = size dcl_modules #! nr_of_dcl_modules = size dcl_modules
# (bitvect, dependencies, dcl_modules, cs_symbol_table) # (bitvect, dependencies, dcl_modules, cs_symbol_table)
...@@ -1762,8 +1762,8 @@ createCommonDefinitionsWithinComponent is_on_cycle mod_index (dcl_modules, cs=:{ ...@@ -1762,8 +1762,8 @@ createCommonDefinitionsWithinComponent is_on_cycle mod_index (dcl_modules, cs=:{
{com_type_defs=type_defs2,com_cons_defs=cons_defs2,com_selector_defs=selector_defs2,com_class_defs=class_defs2,com_member_defs=member_defs2,com_instance_defs=instance_defs2,com_generic_defs=generic_defs2,com_gencase_defs=gencase_defs2}) {com_type_defs=type_defs2,com_cons_defs=cons_defs2,com_selector_defs=selector_defs2,com_class_defs=class_defs2,com_member_defs=member_defs2,com_instance_defs=instance_defs2,com_generic_defs=generic_defs2,com_gencase_defs=gencase_defs2})
checkDclModuleWithinComponent :: .NumberSet Int Bool {#.Int} {![.Int]} (IntKeyHashtable SolvedImports) Int *CommonDefs checkDclModuleWithinComponent :: .NumberSet Int Bool {#.Int} {![.Int]} (IntKeyHashtable SolvedImports) Int *CommonDefs
*(*{!*{!*ExplImpInfo}},*{#.DclModule},*{#*{#.FunDef}},*Heaps,*CheckState) *(*ExplImpInfos,*{#.DclModule},*{#*{#.FunDef}},*Heaps,*CheckState)
-> ((Int,Int,[FunType]),({!{!.ExplImpInfo}},.{# DclModule},.{#.{# FunDef}},.Heaps,.CheckState)) -> ((Int,Int,[FunType]),(*ExplImpInfos,.{# DclModule},.{#.{# FunDef}},.Heaps,.CheckState))
checkDclModuleWithinComponent dcl_imported_module_numbers component_nr is_on_cycle modules_in_component_set components_importing_module_a imports_ikh checkDclModuleWithinComponent dcl_imported_module_numbers component_nr is_on_cycle modules_in_component_set components_importing_module_a imports_ikh
mod_index dcl_common mod_index dcl_common
(expl_imp_infos, dcl_modules, macro_defs, heaps, cs=:{cs_symbol_table}) (expl_imp_infos, dcl_modules, macro_defs, heaps, cs=:{cs_symbol_table})
...@@ -2761,8 +2761,8 @@ add_declaration_to_symbol_table opt_dcl_macro_range (Declaration {decl_kind=STE_ ...@@ -2761,8 +2761,8 @@ add_declaration_to_symbol_table opt_dcl_macro_range (Declaration {decl_kind=STE_
add_declaration_to_symbol_table yes_for_icl_module (Declaration {decl_kind=decl_kind=:STE_Imported def_kind def_mod, decl_ident, decl_index, decl_pos}) importing_mod cs add_declaration_to_symbol_table yes_for_icl_module (Declaration {decl_kind=decl_kind=:STE_Imported def_kind def_mod, decl_ident, decl_index, decl_pos}) importing_mod cs
= addSymbol yes_for_icl_module decl_ident decl_pos decl_kind def_kind decl_index def_mod importing_mod cs = addSymbol yes_for_icl_module decl_ident decl_pos decl_kind def_kind decl_index def_mod importing_mod cs
updateExplImpInfo :: [Int] Index {!Declaration} {!Declaration} u:{#DclModule} {!{!*ExplImpInfo}} *SymbolTable updateExplImpInfo :: [Int] Index {!Declaration} {!Declaration} u:{#DclModule} ExplImpInfos *SymbolTable
-> (u:{#DclModule},!{!{!.ExplImpInfo}},.SymbolTable) -> (u:{#DclModule},!ExplImpInfos,.SymbolTable)
updateExplImpInfo components_importing_module mod_index dcls_import dcls_local_for_import dcl_modules expl_imp_infos cs_symbol_table updateExplImpInfo components_importing_module mod_index dcls_import dcls_local_for_import dcl_modules expl_imp_infos cs_symbol_table
# (changed_symbols, (expl_imp_infos, cs_symbol_table)) # (changed_symbols, (expl_imp_infos, cs_symbol_table))
= mapSt markExplImpSymbols components_importing_module (expl_imp_infos, cs_symbol_table) = mapSt markExplImpSymbols components_importing_module (expl_imp_infos, cs_symbol_table)
...@@ -2774,8 +2774,8 @@ updateExplImpInfo components_importing_module mod_index dcls_import dcls_local_f ...@@ -2774,8 +2774,8 @@ updateExplImpInfo components_importing_module mod_index dcls_import dcls_local_f
= foldSt (\l cs_symbol_table->foldSt restoreHeap l cs_symbol_table) changed_symbols cs_symbol_table = foldSt (\l cs_symbol_table->foldSt restoreHeap l cs_symbol_table) changed_symbols cs_symbol_table
= (dcl_modules, expl_imp_infos, cs_symbol_table) = (dcl_modules, expl_imp_infos, cs_symbol_table)
updateExplImpInfoForCachedModule :: [Int] Index {!Declaration} {!Declaration} {!{!*ExplImpInfo}} u:{#DclModule} *SymbolTable updateExplImpInfoForCachedModule :: [Int] Index {!Declaration} {!Declaration} ExplImpInfos u:{#DclModule} *SymbolTable
-> (!{!{!.ExplImpInfo}},u:{#DclModule},.SymbolTable) -> (!ExplImpInfos,u:{#DclModule},.SymbolTable)
updateExplImpInfoForCachedModule components_importing_module mod_index dcls_import dcls_local_for_import expl_imp_infos dcl_modules cs_symbol_table updateExplImpInfoForCachedModule components_importing_module mod_index dcls_import dcls_local_for_import expl_imp_infos dcl_modules cs_symbol_table
# (changed_symbols, (expl_imp_infos, cs_symbol_table)) # (changed_symbols, (expl_imp_infos, cs_symbol_table))
= mapSt markExplImpSymbols components_importing_module (expl_imp_infos, cs_symbol_table) = mapSt markExplImpSymbols components_importing_module (expl_imp_infos, cs_symbol_table)
...@@ -2927,17 +2927,16 @@ update_expl_imp_for_marked_local_symbol mod_index decl=:(Declaration {decl_ident ...@@ -2927,17 +2927,16 @@ update_expl_imp_for_marked_local_symbol mod_index decl=:(Declaration {decl_ident
# (ste, cs_symbol_table) = readPtr decl_ident.id_info cs_symbol_table # (ste, cs_symbol_table) = readPtr decl_ident.id_info cs_symbol_table
= updateExplImpForMarkedLocalSymbol mod_index decl ste dcl_modules expl_imp_infos cs_symbol_table = updateExplImpForMarkedLocalSymbol mod_index decl ste dcl_modules expl_imp_infos cs_symbol_table
where where
updateExplImpForMarkedLocalSymbol :: !Index Declaration !SymbolTableEntry !u:{#DclModule} !{!{!*ExplImpInfo}} !*SymbolTable updateExplImpForMarkedLocalSymbol :: !Index Declaration !SymbolTableEntry !u:{#DclModule} !ExplImpInfos !*SymbolTable
-> (!u:{#DclModule}, !{!{!.ExplImpInfo}}, !.SymbolTable) -> (!u:{#DclModule}, !ExplImpInfos, !.SymbolTable)
updateExplImpForMarkedLocalSymbol mod_index decl {ste_kind=STE_ExplImpComponentNrs component_numbers} updateExplImpForMarkedLocalSymbol mod_index decl {ste_kind=STE_ExplImpComponentNrs component_numbers}
dcl_modules expl_imp_infos cs_symbol_table dcl_modules expl_imp_infos cs_symbol_table
= foldSt (addExplImpInfo mod_index decl) component_numbers (dcl_modules, expl_imp_infos, cs_symbol_table) = foldSt (addExplImpInfo mod_index decl) component_numbers (dcl_modules, expl_imp_infos, cs_symbol_table)
where where
addExplImpInfo :: !Index Declaration !ComponentNrAndIndex !(!u:{#DclModule}, !{!{!*ExplImpInfo}}, !v:SymbolTable) addExplImpInfo :: !Index Declaration !ComponentNrAndIndex !(!u:{#DclModule}, !ExplImpInfos, !v:SymbolTable)
-> (!u:{#DclModule}, !{!{!.ExplImpInfo}}, !v:SymbolTable) -> (!u:{#DclModule}, !ExplImpInfos, !v:SymbolTable)
addExplImpInfo mod_index decl { cai_component_nr, cai_index } (dcl_modules, expl_imp_infos, cs_symbol_table) addExplImpInfo mod_index decl { cai_component_nr, cai_index } (dcl_modules, expl_imp_infos, cs_symbol_table)
# (ExplImpInfo eii_ident eii_declaring_modules, expl_imp_infos) # (ExplImpInfo eii_ident eii_declaring_modules, expl_imp_infos) = expl_imp_infos![cai_component_nr,cai_index]
= replaceTwoDimArrElt cai_component_nr cai_index TemporarilyFetchedAway expl_imp_infos
(all_belongs, dcl_modules) = getBelongingSymbols decl dcl_modules (all_belongs, dcl_modules) = getBelongingSymbols decl dcl_modules
di_belonging = nsFromTo (nrOfBelongingSymbols all_belongs) di_belonging = nsFromTo (nrOfBelongingSymbols all_belongs)
di = { di_decl = decl, di_belonging = di_belonging } di = { di_decl = decl, di_belonging = di_belonging }
...@@ -2958,8 +2957,7 @@ checkInstancesOfDclModule mod_index (nr_of_dcl_functions_and_instances, nr_of_dc ...@@ -2958,8 +2957,7 @@ checkInstancesOfDclModule mod_index (nr_of_dcl_functions_and_instances, nr_of_dc
{d \\ d<-:dcl_common.com_class_defs} {d \\ d<-:dcl_common.com_class_defs}
{d \\ d<-:dcl_common.com_member_defs} {d \\ d<-:dcl_common.com_member_defs}
dcl_modules hp_type_heaps hp_var_heap { cs & cs_error = cs_error } dcl_modules hp_type_heaps hp_var_heap { cs & cs_error = cs_error }
heaps heaps = { heaps & hp_type_heaps = hp_type_heaps, hp_var_heap = hp_var_heap }
= { heaps & hp_type_heaps = hp_type_heaps, hp_var_heap = hp_var_heap }
(nr_of_dcl_funs_insts_and_specs, new_class_instances, rev_special_defs, all_spec_types, heaps, cs_predef_symbols,cs_error) (nr_of_dcl_funs_insts_and_specs, new_class_instances, rev_special_defs, all_spec_types, heaps, cs_predef_symbols,cs_error)
= checkSpecialsOfInstances mod_index nr_of_dcl_functions rev_spec_class_inst nr_of_dcl_funs_insts_and_specs [] = checkSpecialsOfInstances mod_index nr_of_dcl_functions rev_spec_class_inst nr_of_dcl_funs_insts_and_specs []
rev_special_defs { mem \\ mem <- memb_inst_defs } { [] \\ mem <- memb_inst_defs } heaps cs.cs_predef_symbols cs.cs_error rev_special_defs { mem \\ mem <- memb_inst_defs } { [] \\ mem <- memb_inst_defs } heaps cs.cs_predef_symbols cs.cs_error
......
...@@ -48,11 +48,10 @@ cMacroDefs :== 9 ...@@ -48,11 +48,10 @@ cMacroDefs :== 9
cConversionTableSize :== 10 cConversionTableSize :== 10
:: *ExplImpInfos :== *{!*{!*ExplImpInfo}} :: *ExplImpInfos :== *{#*{!*ExplImpInfo}}
:: ExplImpInfo :: ExplImpInfo
= ExplImpInfo Ident !.DeclaringModulesSet = ExplImpInfo Ident !.DeclaringModulesSet
| TemporarilyFetchedAway
:: DeclaringModulesSet :== IntKeyHashtable DeclarationInfo :: DeclaringModulesSet :== IntKeyHashtable DeclarationInfo
......
...@@ -20,11 +20,10 @@ import syntax, checksupport ...@@ -20,11 +20,10 @@ import syntax, checksupport
, si_implicit :: ![(ModuleN, Position)] , si_implicit :: ![(ModuleN, Position)]
} }
markExplImpSymbols :: !Int !*(!*{!*{!u:ExplImpInfo}}, !*SymbolTable) markExplImpSymbols :: !Int !*(!*ExplImpInfos,!*SymbolTable) -> (!.[Ident],!(!*ExplImpInfos,!*SymbolTable))
-> (!.[Ident],!(!{!{!u:ExplImpInfo}},!.SymbolTable))
updateExplImpForMarkedSymbol :: !Index !Declaration !SymbolTableEntry !u:{#DclModule} !{!{!*ExplImpInfo}} !*SymbolTable updateExplImpForMarkedSymbol :: !Index !Declaration !SymbolTableEntry !u:{#DclModule} !*ExplImpInfos !*SymbolTable
-> (!u:{#DclModule}, !{!{!.ExplImpInfo}}, !.SymbolTable) -> (!u:{#DclModule},!*ExplImpInfos,!*SymbolTable)
solveExplicitImports :: !(IntKeyHashtable [ExplicitImport]) !{#Int} !Index solveExplicitImports :: !(IntKeyHashtable [ExplicitImport]) !{#Int} !Index
!*(!v:{#DclModule},!*{#Int},!{!*ExplImpInfo},!*CheckState) !*(!v:{#DclModule},!*{#Int},!{!*ExplImpInfo},!*CheckState)
......
...@@ -3,8 +3,7 @@ implementation module explicitimports ...@@ -3,8 +3,7 @@ implementation module explicitimports
import StdEnv import StdEnv
import syntax, typesupport, parse, checksupport, utilities, checktypes, transform, predef, import syntax, typesupport, parse, checksupport, utilities, checktypes, transform, predef
compilerSwitches//, RWSDebug
cUndef :== (-1) cUndef :== (-1)
implies a b :== not a || b implies a b :== not a || b
...@@ -20,7 +19,7 @@ implies a b :== not a || b ...@@ -20,7 +19,7 @@ implies a b :== not a || b
, si_implicit :: ![(ModuleN, Position)] , si_implicit :: ![(ModuleN, Position)]
} }
markExplImpSymbols :: !Int !*(!*{!*{!u:ExplImpInfo}}, !*SymbolTable) -> (!.[Ident],!(!{!{!u:ExplImpInfo}},!.SymbolTable)) markExplImpSymbols :: !Int !*(!*ExplImpInfos,!*SymbolTable) -> (!.[Ident],!(!*ExplImpInfos,!*SymbolTable))
markExplImpSymbols component_nr (expl_imp_info, cs_symbol_table) markExplImpSymbols component_nr (expl_imp_info, cs_symbol_table)
# (expl_imp_info_from_component,expl_imp_info) = replace expl_imp_info component_nr {} # (expl_imp_info_from_component,expl_imp_info) = replace expl_imp_info component_nr {}
#! nr_of_expl_imp_symbols = size expl_imp_info_from_component #! nr_of_expl_imp_symbols = size expl_imp_info_from_component
...@@ -29,9 +28,9 @@ markExplImpSymbols component_nr (expl_imp_info, cs_symbol_table) ...@@ -29,9 +28,9 @@ markExplImpSymbols component_nr (expl_imp_info, cs_symbol_table)
= (new_symbols, (expl_imp_info, cs_symbol_table)) = (new_symbols, (expl_imp_info, cs_symbol_table))
where where
mark_symbol component_nr i (changed_symbols_accu, expl_imp_info_from_component, cs_symbol_table) mark_symbol component_nr i (changed_symbols_accu, expl_imp_info_from_component, cs_symbol_table)
# (eii, expl_imp_info_from_component) = replace expl_imp_info_from_component i TemporarilyFetchedAway # (eii, expl_imp_info_from_component) = expl_imp_info_from_component![i]
(eii_ident, eii) = get_eei_ident eii (eii_ident, eii) = get_eei_ident eii
expl_imp_info_from_component = { expl_imp_info_from_component & [i] = eii } expl_imp_info_from_component = {expl_imp_info_from_component & [i] = eii}
(ste, cs_symbol_table) = readPtr eii_ident.id_info cs_symbol_table (ste, cs_symbol_table) = readPtr eii_ident.id_info cs_symbol_table
cai = { cai_component_nr = component_nr, cai_index = i } cai = { cai_component_nr = component_nr, cai_index = i }
= case ste.ste_kind of = case ste.ste_kind of
...@@ -43,26 +42,25 @@ markExplImpSymbols component_nr (expl_imp_info, cs_symbol_table) ...@@ -43,26 +42,25 @@ markExplImpSymbols component_nr (expl_imp_info, cs_symbol_table)
# new_ste = { ste & ste_kind = STE_ExplImpComponentNrs [cai], ste_previous = ste } # new_ste = { ste & ste_kind = STE_ExplImpComponentNrs [cai], ste_previous = ste }
-> ([eii_ident:changed_symbols_accu], expl_imp_info_from_component, writePtr eii_ident.id_info new_ste cs_symbol_table) -> ([eii_ident:changed_symbols_accu], expl_imp_info_from_component, writePtr eii_ident.id_info new_ste cs_symbol_table)
updateExplImpForMarkedSymbol :: !Index !Declaration !SymbolTableEntry !u:{#DclModule} !{!{!*ExplImpInfo}} !*SymbolTable updateExplImpForMarkedSymbol :: !Index !Declaration !SymbolTableEntry !u:{#DclModule} !*ExplImpInfos !*SymbolTable
-> (!u:{#DclModule}, !{!{!.ExplImpInfo}}, !.SymbolTable) -> (!u:{#DclModule},!*ExplImpInfos,!*SymbolTable)
updateExplImpForMarkedSymbol mod_index decl {ste_kind=STE_ExplImpComponentNrs component_numbers} dcl_modules expl_imp_infos cs_symbol_table updateExplImpForMarkedSymbol mod_index decl {ste_kind=STE_ExplImpComponentNrs component_numbers} dcl_modules expl_imp_infos cs_symbol_table
= foldSt (addExplImpInfo mod_index decl) component_numbers (dcl_modules, expl_imp_infos, cs_symbol_table) = foldSt (addExplImpInfo mod_index decl) component_numbers (dcl_modules, expl_imp_infos, cs_symbol_table)
updateExplImpForMarkedSymbol _ _ entry dcl_modules expl_imp_infos cs_symbol_table updateExplImpForMarkedSymbol _ _ entry dcl_modules expl_imp_infos cs_symbol_table
= (dcl_modules, expl_imp_infos, cs_symbol_table) = (dcl_modules, expl_imp_infos, cs_symbol_table)
addExplImpInfo :: !Index Declaration !ComponentNrAndIndex !(!u:{#DclModule}, !{!{!*ExplImpInfo}}, !v:SymbolTable) addExplImpInfo :: !Index Declaration !ComponentNrAndIndex !(!u:{#DclModule},!*ExplImpInfos,!*SymbolTable)
-> (!u:{#DclModule}, !{!{!.ExplImpInfo}}, !v:SymbolTable) -> (!u:{#DclModule},!*ExplImpInfos,!*SymbolTable)
addExplImpInfo mod_index decl { cai_component_nr, cai_index } (dcl_modules, expl_imp_infos, cs_symbol_table) addExplImpInfo mod_index decl { cai_component_nr, cai_index } (dcl_modules, expl_imp_infos, cs_symbol_table)
# (ExplImpInfo eii_ident eii_declaring_modules, expl_imp_infos) # (ExplImpInfo eii_ident eii_declaring_modules, expl_imp_infos) = expl_imp_infos![cai_component_nr,cai_index]
= replaceTwoDimArrElt cai_component_nr cai_index TemporarilyFetchedAway expl_imp_infos
(di_belonging, dcl_modules, cs_symbol_table) (di_belonging, dcl_modules, cs_symbol_table)
= get_belonging_symbol_nrs decl dcl_modules cs_symbol_table = get_belonging_symbol_nrs decl dcl_modules cs_symbol_table
di = { di_decl = decl, di_belonging = di_belonging } di = { di_decl = decl, di_belonging = di_belonging }
new_expl_imp_info = ExplImpInfo eii_ident (ikhInsert` False mod_index di eii_declaring_modules) new_expl_imp_info = ExplImpInfo eii_ident (ikhInsert` False mod_index di eii_declaring_modules)
= (dcl_modules, { expl_imp_infos & [cai_component_nr,cai_index] = new_expl_imp_info }, cs_symbol_table) = (dcl_modules, { expl_imp_infos & [cai_component_nr,cai_index] = new_expl_imp_info }, cs_symbol_table)
where where
get_belonging_symbol_nrs :: !Declaration !v:{#DclModule} !u:(Heap SymbolTableEntry) get_belonging_symbol_nrs :: !Declaration !v:{#DclModule} !*SymbolTable
-> (!.NumberSet,!v:{#DclModule},!u: Heap SymbolTableEntry) -> (!.NumberSet,!v:{#DclModule},!*SymbolTable)
get_belonging_symbol_nrs decl dcl_modules cs_symbol_table get_belonging_symbol_nrs decl dcl_modules cs_symbol_table
# (all_belonging_symbols, dcl_modules) = getBelongingSymbols decl dcl_modules # (all_belonging_symbols, dcl_modules) = getBelongingSymbols decl dcl_modules
nr_of_belongs = nrOfBelongingSymbols all_belonging_symbols nr_of_belongs = nrOfBelongingSymbols all_belonging_symbols
...@@ -143,7 +141,7 @@ solveExplicitImports expl_imp_indices_ikh modules_in_component_set importing_mod ...@@ -143,7 +141,7 @@ solveExplicitImports expl_imp_indices_ikh modules_in_component_set importing_mod
solve_qualified_expl_imp_from_module expl_imp_indices_ikh modules_in_component_set path solve_qualified_expl_imp_from_module expl_imp_indices_ikh modules_in_component_set path
{ei_module_n=imported_mod, ei_position=position, ei_symbols=imported_symbols} (dcl_modules, visited_modules, expl_imp_info, cs) {ei_module_n=imported_mod, ei_position=position, ei_symbols=imported_symbols} (dcl_modules, visited_modules, expl_imp_info, cs)
# (not_exported_symbols,decl_accu, unsolved_belonging, visited_modules, expl_imp_info) # (not_exported_symbols,decl_accu, unsolved_belonging, visited_modules, expl_imp_info)
= search_expl_imp_symbols imported_symbols expl_imp_indices_ikh modules_in_component_set path imported_mod = search_qualified_expl_imp_symbols imported_symbols expl_imp_indices_ikh modules_in_component_set path imported_mod
([],[], [], visited_modules, expl_imp_info) ([],[], [], visited_modules, expl_imp_info)
(expl_imp_info,dcl_modules,cs_error) (expl_imp_info,dcl_modules,cs_error)
= report_not_exported_symbol_errors not_exported_symbols position expl_imp_info imported_mod dcl_modules cs.cs_error = report_not_exported_symbol_errors not_exported_symbols position expl_imp_info imported_mod dcl_modules cs.cs_error
...@@ -156,6 +154,10 @@ solveExplicitImports expl_imp_indices_ikh modules_in_component_set importing_mod ...@@ -156,6 +154,10 @@ solveExplicitImports expl_imp_indices_ikh modules_in_component_set importing_mod
= foldSt (search_expl_imp_symbol expl_imp_indices_ikh modules_in_component_set path imported_mod) = foldSt (search_expl_imp_symbol expl_imp_indices_ikh modules_in_component_set path imported_mod)
imported_symbols state imported_symbols state
search_qualified_expl_imp_symbols imported_symbols expl_imp_indices_ikh modules_in_component_set path imported_mod state
= foldSt (search_qualified_expl_imp_symbol expl_imp_indices_ikh modules_in_component_set path imported_mod)
imported_symbols state
solve_belongings unsolved_belonging position expl_imp_indices_ikh modules_in_component_set path state solve_belongings unsolved_belonging position expl_imp_indices_ikh modules_in_component_set path state
= foldSt (solve_belonging position expl_imp_indices_ikh modules_in_component_set path) = foldSt (solve_belonging position expl_imp_indices_ikh modules_in_component_set path)
unsolved_belonging state unsolved_belonging state
...@@ -163,12 +165,9 @@ solveExplicitImports expl_imp_indices_ikh modules_in_component_set importing_mod ...@@ -163,12 +165,9 @@ solveExplicitImports expl_imp_indices_ikh modules_in_component_set importing_mod
solve_belonging position expl_imp_indices_ikh modules_in_component_set path solve_belonging position expl_imp_indices_ikh modules_in_component_set path
(decl, {ini_symbol_nr, ini_imp_decl}, imported_mod) (decl, {ini_symbol_nr, ini_imp_decl}, imported_mod)
(decls_accu, dcl_modules, visited_modules, expl_imp_info, cs=:{cs_error, cs_symbol_table}) (decls_accu, dcl_modules, visited_modules, expl_imp_info, cs=:{cs_error, cs_symbol_table})
# (Yes belongs) # (Yes belongs) = getBelongingSymbolsFromID ini_imp_decl
= getBelongingSymbolsFromID ini_imp_decl (all_belongs, dcl_modules) = get_all_belongs decl dcl_modules
(all_belongs, dcl_modules) (ExplImpInfo eii_ident eii_declaring_modules, expl_imp_info) = expl_imp_info![ini_symbol_nr]
= get_all_belongs decl dcl_modules
(ExplImpInfo eii_ident eii_declaring_modules, expl_imp_info)
= replace expl_imp_info ini_symbol_nr TemporarilyFetchedAway
(need_all, belongs_set, cs_error, cs_symbol_table) (need_all, belongs_set, cs_error, cs_symbol_table)
= case belongs of = case belongs of
[] []
...@@ -218,13 +217,12 @@ solveExplicitImports expl_imp_indices_ikh modules_in_component_set importing_mod ...@@ -218,13 +217,12 @@ solveExplicitImports expl_imp_indices_ikh modules_in_component_set importing_mod
(new, eii_declaring_modules) (new, eii_declaring_modules)
= ikhInsert True mod_index { di & di_belonging = addNr belong_nr di_belonging } eii_declaring_modules = ikhInsert True mod_index { di & di_belonging = addNr belong_nr di_belonging } eii_declaring_modules
| new | new
= abort "sanity check nr 2765 failed in module check" = abort "sanity check failed in module explicitimports"
= eii_declaring_modules = eii_declaring_modules
get_nth_belonging_decl position belong_nr decl=:(Declaration {decl_kind}) dcl_modules get_nth_belonging_decl position belong_nr decl=:(Declaration {decl_kind}) dcl_modules
# (STE_Imported _ def_mod_index) = decl_kind # (STE_Imported _ def_mod_index) = decl_kind
(belongin_symbols, dcl_modules) (belongin_symbols, dcl_modules) = getBelongingSymbols decl dcl_modules
= getBelongingSymbols decl dcl_modules
= case belongin_symbols of = case belongin_symbols of
BS_Constructors constructors BS_Constructors constructors
# {ds_ident, ds_index} = constructors!!belong_nr # {ds_ident, ds_index} = constructors!!belong_nr
...@@ -245,17 +243,13 @@ solveExplicitImports expl_imp_indices_ikh modules_in_component_set importing_mod ...@@ -245,17 +243,13 @@ solveExplicitImports expl_imp_indices_ikh modules_in_component_set importing_mod
decl_index = ds_index }, dcl_modules) decl_index = ds_index }, dcl_modules)
get_all_belongs decl=:(Declaration {decl_kind,decl_index}) dcl_modules get_all_belongs decl=:(Declaration {decl_kind,decl_index}) dcl_modules
# (belonging_symbols, dcl_modules) # (belonging_symbols, dcl_modules) = getBelongingSymbols decl dcl_modules
= getBelongingSymbols decl dcl_modules
= case belonging_symbols of = case belonging_symbols of
BS_Constructors constructors BS_Constructors constructors
-> ([ds_ident \\ {ds_ident}<-constructors], dcl_modules) -> ([ds_ident \\ {ds_ident}<-constructors], dcl_modules)
BS_Fields rt_fields BS_Fields rt_fields
-> ([fs_ident \\ {fs_ident}<-:rt_fields], dcl_modules) -> ([fs_ident \\ {fs_ident}<-:rt_fields], dcl_modules)
BS_Members class_members BS_Members class_members
# (STE_Imported _ def_mod_index) = decl_kind
({class_members}, dcl_modules)
= dcl_modules![def_mod_index].dcl_common.com_class_defs.[decl_index]
-> ([ds_ident \\ {ds_ident}<-:class_members], dcl_modules) -> ([ds_ident \\ {ds_ident}<-:class_members], dcl_modules)
BS_Nothing BS_Nothing
-> ([], dcl_modules) -> ([], dcl_modules)
...@@ -280,48 +274,59 @@ solveExplicitImports expl_imp_indices_ikh modules_in_component_set importing_mod ...@@ -280,48 +274,59 @@ solveExplicitImports expl_imp_indices_ikh modules_in_component_set importing_mod
-> ([ImportNrAndIdents],[Declaration],[(Declaration,ImportNrAndIdents,Int)],*{#Int},*{!*ExplImpInfo}) -> ([ImportNrAndIdents],[Declaration],[(Declaration,ImportNrAndIdents,Int)],*{#Int},*{!*ExplImpInfo})
search_expl_imp_symbol expl_imp_indices_ikh modules_in_component_set path imported_mod search_expl_imp_symbol expl_imp_indices_ikh modules_in_component_set path imported_mod
ini=:{ini_symbol_nr} (not_exported_symbols,decls_accu, belonging_accu, visited_modules, expl_imp_info) ini=:{ini_symbol_nr} (not_exported_symbols,decls_accu, belonging_accu, visited_modules, expl_imp_info)
# (ExplImpInfo eii_ident eii_declaring_modules, expl_imp_info) # (ExplImpInfo eii_ident eii_declaring_modules, expl_imp_info) = expl_imp_info![ini_symbol_nr]
= replace expl_imp_info ini_symbol_nr TemporarilyFetchedAway (opt_decl, path, eii_declaring_modules, visited_modules)
= depth_first_search expl_imp_indices_ikh modules_in_component_set imported_mod
ini_symbol_nr cUndef stupid_ident path
eii_declaring_modules (bitvectResetAll visited_modules)
= case opt_decl of
Yes di=:{di_decl=di_decl=:Declaration {decl_kind}}
| is_not_STE_member decl_kind
# new_eii_declaring_modules = update_declaring_modules di_decl path eii_declaring_modules
expl_imp_info = {expl_imp_info & [ini_symbol_nr] = ExplImpInfo eii_ident new_eii_declaring_modules}
new_belonging_accu = update_belonging_accu di_decl ini imported_mod belonging_accu
-> (not_exported_symbols,[di_decl:decls_accu], new_belonging_accu, visited_modules, expl_imp_info)
_
# expl_imp_info = {expl_imp_info & [ini_symbol_nr] = ExplImpInfo eii_ident eii_declaring_modules}
-> ([ini:not_exported_symbols],decls_accu, belonging_accu, visited_modules, expl_imp_info)
search_qualified_expl_imp_symbol :: (IntKeyHashtable [ExplicitImport]) {#Int} [Int] Int ImportNrAndIdents
*([ImportNrAndIdents],[Declaration],[(Declaration,ImportNrAndIdents,Int)],*{#Int},*{!*ExplImpInfo})
-> ([ImportNrAndIdents],[Declaration],[(Declaration,ImportNrAndIdents,Int)],*{#Int},*{!*ExplImpInfo})
search_qualified_expl_imp_symbol expl_imp_indices_ikh modules_in_component_set path imported_mod
ini=:{ini_symbol_nr} (not_exported_symbols,decls_accu, belonging_accu, visited_modules, expl_imp_info)
# (ExplImpInfo eii_ident eii_declaring_modules, expl_imp_info) = expl_imp_info![ini_symbol_nr]
(opt_decl, path, eii_declaring_modules, visited_modules) (opt_decl, path, eii_declaring_modules, visited_modules)
= depth_first_search expl_imp_indices_ikh modules_in_component_set imported_mod = depth_first_search expl_imp_indices_ikh modules_in_component_set imported_mod
ini_symbol_nr cUndef stupid_ident path ini_symbol_nr cUndef stupid_ident path
eii_declaring_modules (bitvectResetAll visited_modules) eii_declaring_modules (bitvectResetAll visited_modules)
= case opt_decl of = case opt_decl of
Yes di=:{di_decl} Yes di=:{di_decl}
| ( case di_decl of # new_eii_declaring_modules = update_declaring_modules di_decl path eii_declaring_modules
Declaration {decl_kind} expl_imp_info = {expl_imp_info & [ini_symbol_nr] = ExplImpInfo eii_ident new_eii_declaring_modules}
-> case decl_kind of new_belonging_accu = update_belonging_accu di_decl ini imported_mod belonging_accu
STE_Imported STE_Member _ -> (not_exported_symbols,[di_decl:decls_accu], new_belonging_accu, visited_modules, expl_imp_info)
-> False
STE_Member
-> False
_
-> True
)
# new_eii_declaring_modules
= foldSt (\mod_index eei_dm->ikhInsert` False mod_index
{di_decl = di_decl, di_belonging=EndNumbers} eei_dm)
path eii_declaring_modules
new_belonging_accu
= case getBelongingSymbolsFromID ini.ini_imp_decl of
No
-> belonging_accu
Yes _
-> [(di_decl, ini, imported_mod):belonging_accu]
new_eii = ExplImpInfo eii_ident new_eii_declaring_modules
-> (not_exported_symbols,[di_decl:decls_accu], new_belonging_accu, visited_modules,
{ expl_imp_info & [ini_symbol_nr] = new_eii })
// otherwise GOTO next alternative
_ _
# eii = ExplImpInfo eii_ident eii_declaring_modules # expl_imp_info = {expl_imp_info & [ini_symbol_nr] = ExplImpInfo eii_ident eii_declaring_modules}
-> ([ini:not_exported_symbols],decls_accu, belonging_accu, visited_modules, { expl_imp_info & [ini_symbol_nr] = eii }) -> ([ini:not_exported_symbols],decls_accu, belonging_accu, visited_modules, expl_imp_info)
is_not_STE_member (STE_Imported STE_Member _) = False
is_not_STE_member STE_Member = False
is_not_STE_member _ = True
update_declaring_modules di_decl path eii_declaring_modules
= foldSt (\mod_index eei_dm->ikhInsert` False mod_index {di_decl = di_decl, di_belonging=EndNumbers} eei_dm) path eii_declaring_modules
update_belonging_accu di_decl ini imported_mod belonging_accu
= case getBelongingSymbolsFromID ini.ini_imp_decl of
No -> belonging_accu
Yes _ -> [(di_decl, ini, imported_mod):belonging_accu]
depth_first_search expl_imp_indices_ikh modules_in_component_set depth_first_search expl_imp_indices_ikh modules_in_component_set
imported_mod imported_symbol belong_nr belong_ident path eii_declaring_modules visited_modules imported_mod imported_symbol belong_nr belong_ident path eii_declaring_modules visited_modules
// | False--->("depth_first_search imported_mod", imported_mod, "imported_symbol", imported_symbol) // | False--->("depth_first_search imported_mod", imported_mod, "imported_symbol", imported_symbol)
// = undef // = undef
# (search_result, eii_declaring_modules) # (search_result, eii_declaring_modules) = ikhUSearch imported_mod eii_declaring_modules
= ikhUSearch imported_mod eii_declaring_modules
= case search_result of = case search_result of
yes_di=:(Yes di) yes_di=:(Yes di)
| belong_nr==cUndef | belong_nr==cUndef
...@@ -333,8 +338,7 @@ solveExplicitImports expl_imp_indices_ikh modules_in_component_set importing_mod ...@@ -333,8 +338,7 @@ solveExplicitImports expl_imp_indices_ikh modules_in_component_set importing_mod
// the eii_declaring_modules is complete for modules that are outside // the eii_declaring_modules is complete for modules that are outside
// (=beneath) the actual component=> no need to search further // (=beneath) the actual component=> no need to search further
-> (No, [], eii_declaring_modules, visited_modules) -> (No, [], eii_declaring_modules, visited_modules)
# imports_of_imported_mod # imports_of_imported_mod = ikhSearch` imported_mod expl_imp_indices_ikh
= ikhSearch` imported_mod expl_imp_indices_ikh
-> try_children imports_of_imported_mod expl_imp_indices_ikh -> try_children imports_of_imported_mod expl_imp_indices_ikh
modules_in_component_set imported_symbol belong_nr belong_ident modules_in_component_set imported_symbol belong_nr belong_ident
[imported_mod:path] [imported_mod:path]
...@@ -343,7 +347,6 @@ solveExplicitImports expl_imp_indices_ikh modules_in_component_set importing_mod ...@@ -343,7 +347,6 @@ solveExplicitImports expl_imp_indices_ikh modules_in_component_set importing_mod
try_children [{ei_module_n=imp_imp_mod,ei_symbols=imp_imp_symbols}:imports] expl_imp_indices_ikh try_children [{ei_module_n=imp_imp_mod,ei_symbols=imp_imp_symbols}:imports] expl_imp_indices_ikh
modules_in_component_set imported_symbol belong_nr belong_ident path eii_declaring_modules visited_modules modules_in_component_set imported_symbol belong_nr belong_ident path eii_declaring_modules visited_modules
| bitvectSelect imp_imp_mod visited_modules | bitvectSelect imp_imp_mod visited_modules
// | False--->"visited" = undef
= try_children imports expl_imp_indices_ikh modules_in_component_set imported_symbol = try_children imports expl_imp_indices_ikh modules_in_component_set imported_symbol
belong_nr belong_ident path eii_declaring_modules visited_modules belong_nr belong_ident path eii_declaring_modules visited_modules
| not (isEmpty imp_imp_symbols) | not (isEmpty imp_imp_symbols)
...@@ -402,7 +405,9 @@ solveExplicitImports expl_imp_indices_ikh modules_in_component_set importing_mod ...@@ -402,7 +405,9 @@ solveExplicitImports expl_imp_indices_ikh modules_in_component_set importing_mod
= is_member belong_ident t = is_member belong_ident t
report_not_exported_symbol_errors [{ini_symbol_nr,ini_imp_decl}:not_exported_symbols] position expl_imp_info imported_mod dcl_modules cs_error report_not_exported_symbol_errors [{ini_symbol_nr,ini_imp_decl}:not_exported_symbols] position expl_imp_info imported_mod dcl_modules cs_error
# (eii_ident, expl_imp_info) = do_a_lot_just_to_read_an_array_2 ini_symbol_nr expl_imp_info # (eii, expl_imp_info) = expl_imp_info![ini_symbol_nr]
(eii_ident, eii) = get_eei_ident eii
expl_imp_info = {expl_imp_info & [ini_symbol_nr] = eii}
(module_name,dcl_modules)=dcl_modules![imported_mod].dcl_name.id_name (module_name,dcl_modules)=dcl_modules![imported_mod].dcl_name.id_name
cs_error = popErrorAdmin (checkError eii_ident cs_error = popErrorAdmin (checkError eii_ident
("not exported as a "+++impDeclToNameSpaceString ini_imp_decl +++" by module "+++module_name) ("not exported as a "+++impDeclToNameSpaceString ini_imp_decl +++" by module "+++module_name)
...@@ -411,11 +416,6 @@ solveExplicitImports expl_imp_indices_ikh modules_in_component_set importing_mod ...@@ -411,11 +416,6 @@ solveExplicitImports expl_imp_indices_ikh modules_in_component_set importing_mod
report_not_exported_symbol_errors [] position expl_imp_info imported_mod dcl_modules cs_error report_not_exported_symbol_errors [] position expl_imp_info imported_mod dcl_modules cs_error
= (expl_imp_info,dcl_modules,cs_error) = (expl_imp_info,dcl_modules,cs_error)
do_a_lot_just_to_read_an_array_2 i expl_imp_info
# (eii, expl_imp_info) = replace expl_imp_info i TemporarilyFetchedAway
(eii_ident, eii) = get_eei_ident eii
= (eii_ident, { expl_imp_info & [i] = eii })
impDeclToNameSpaceString (ID_Function _) = "function/macro" impDeclToNameSpaceString (ID_Function _) = "function/macro"
impDeclToNameSpaceString (ID_Class _ _) = "class" impDeclToNameSpaceString (ID_Class _ _) = "class"
impDeclToNameSpaceString (ID_Type _ _) = "type" impDeclToNameSpaceString (ID_Type _ _) = "type"
...@@ -732,7 +732,7 @@ instance check_completeness SymbIdent where ...@@ -732,7 +732,7 @@ instance check_completeness SymbIdent where
= case symb_kind of = case symb_kind of
SK_Constructor {glob_module,glob_object} SK_Constructor {glob_module,glob_object}
-> check_whether_ident_is_imported symb_ident glob_module glob_object STE_Constructor cci ccs -> check_whether_ident_is_imported symb_ident glob_module glob_object STE_Constructor cci ccs
SK_Function global_index SK_Function global_index
-> check_completeness_for_function symb_ident global_index cci ccs -> check_completeness_for_function symb_ident global_index cci ccs
SK_DclMacro global_index SK_DclMacro global_index
-> check_completeness_for_macro symb_ident global_index cci ccs -> check_completeness_for_macro symb_ident global_index cci ccs
......
...@@ -211,6 +211,3 @@ isEmptyBag :: !(Bag x) -> Bool ...@@ -211,6 +211,3 @@ isEmptyBag :: !(Bag x) -> Bool
} }