Commit 1f079ac3 authored by John van Groningen's avatar John van Groningen
Browse files

move types ExplImpInfos, ExplImpInfo, DeclaringModulesSet and DeclarationInfo

from module checksupport to explicitimports,
make ExplImpInfo abstract and don't export DeclaringModulesSet and DeclarationInfo
parent 8908af8d
......@@ -1625,10 +1625,7 @@ checkDclModules imports_of_icl_mod dcl_modules macro_defs heaps cs=:{cs_symbol_t
= mapY2St (get_expl_imp_symbols_of_component imports_of_icl_mod) components (dcl_modules, cs_symbol_table)
expl_imp_infos
= { { ExplImpInfo expl_imp_symbol ikhEmpty
\\ expl_imp_symbol <- expl_imp_symbols_in_component
}
\\ expl_imp_symbols_in_component<-expl_imp_symbols_in_components }
= {idents_to_empty_ExplImpInfo_array expl_imp_symbols_in_component \\ expl_imp_symbols_in_component<-expl_imp_symbols_in_components}
// eii_declaring_modules will be updated later
cs = { cs & cs_symbol_table = cs_symbol_table }
nr_of_icl_component = component_numbers.[index_of_icl_module]
......@@ -3146,13 +3143,10 @@ where
= foldSt (addExplImpInfo mod_index decl) component_numbers (dcl_modules, expl_imp_infos)
where
addExplImpInfo :: !Index Declaration !ComponentNrAndIndex !(!u:{#DclModule}, !ExplImpInfos) -> (!u:{#DclModule}, !ExplImpInfos)
addExplImpInfo mod_index decl { cai_component_nr, cai_index } (dcl_modules, expl_imp_infos)
# (ExplImpInfo eii_ident eii_declaring_modules, expl_imp_infos) = expl_imp_infos![cai_component_nr,cai_index]
(all_belongs, dcl_modules) = getBelongingSymbols decl dcl_modules
di_belonging = nsFromTo (nrOfBelongingSymbols all_belongs)
di = { di_decl = decl, di_belonging = di_belonging }
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 })
addExplImpInfo mod_index decl component_n_and_index (dcl_modules, expl_imp_infos)
# (all_belong_s,dcl_modules) = getBelongingSymbols decl dcl_modules
expl_imp_infos = addDeclarationWithAllBelongingsToExplImpInfo decl all_belong_s mod_index component_n_and_index expl_imp_infos
= (dcl_modules, expl_imp_infos)
updateExplImpForMarkedLocalSymbol _ _ entry dcl_modules expl_imp_infos
= (dcl_modules, expl_imp_infos)
......
......@@ -53,18 +53,6 @@ cMacroDefs :== 9
cConversionTableSize :== 10
:: *ExplImpInfos :== *{#*{!*ExplImpInfo}}
:: ExplImpInfo
= ExplImpInfo Ident !.DeclaringModulesSet
:: DeclaringModulesSet :== IntKeyHashtable DeclarationInfo
:: DeclarationInfo =
{ di_decl :: !Declaration
, di_belonging :: !NumberSet
}
class Erroradmin state
where
pushErrorAdmin :: !IdentPos *state -> *state
......@@ -92,7 +80,7 @@ instance toIdent ConsDef, (TypeDef a), ClassDef, MemberDef, FunDef, SelectorDef
instance toIdent SymbIdent, TypeSymbIdent, BoundVar, TypeVar, ATypeVar, Ident
instance toInt STE_Kind
instance <<< IdentPos, StringPos, ExplImpInfo, DeclarationInfo
instance <<< IdentPos, StringPos
:: ExpressionInfo =
{ ef_type_defs :: !.{# CheckedTypeDef}
......
......@@ -435,7 +435,6 @@ newFreeVariable new_var vars=:[free_var=:{fv_def_level,fv_info_ptr}: free_vars]
newFreeVariable new_var []
= (True, [new_var])
local_declaration_for_import :: !u:Declaration .Index -> v:Declaration, [u <= v]
local_declaration_for_import decl=:(Declaration {decl_kind=STE_FunctionOrMacro _}) module_n
= decl
......@@ -464,7 +463,6 @@ instance toIdent ATypeVar
where
toIdent {atv_variable} = atv_variable.tv_ident
instance toIdent Ident
where
toIdent id = id
......@@ -493,12 +491,6 @@ instance toIdent SelectorDef
where
toIdent sd = sd.sd_ident
/*
instance toIdent DeltaRule
where
toIdent delta = delta.delta_name
*/
instance toIdent (a,b) | toIdent a
where
toIdent (x,y) = toIdent x
......@@ -524,16 +516,6 @@ instance <<< StringPos where
= file <<< '[' <<< sp_file <<< ',' <<< sp_name <<< ']'
= file <<< '[' <<< sp_file <<< ',' <<< sp_line <<< ',' <<< sp_name <<< ']'
instance <<< ExplImpInfo
where
(<<<) file (ExplImpInfo eii_ident eii_declaring_modules)
= file <<< eii_ident //<<< " is declared in " <<< eii_declaring_modules
instance <<< DeclarationInfo
where
(<<<) file {di_decl}
= file <<< di_decl
import_ident :: Ident
import_ident =: { id_name = "import", id_info = nilPtr }
......
......@@ -2,6 +2,10 @@ definition module explicitimports
import syntax, checksupport
:: *ExplImpInfos :== *{#*{!*ExplImpInfo}}
:: ExplImpInfo
:: ImportNrAndIdents =
{ ini_symbol_nr :: !Index
, ini_imp_decl :: !ImportDeclaration
......@@ -20,6 +24,10 @@ import syntax, checksupport
, si_implicit :: ![(ModuleN, Position)]
}
idents_to_empty_ExplImpInfo_array :: ![Ident] -> *{!*ExplImpInfo}
addDeclarationWithAllBelongingsToExplImpInfo :: !Declaration !BelongingSymbols !Index !ComponentNrAndIndex !ExplImpInfos -> ExplImpInfos
markExplImpSymbols :: !Int !*(!*ExplImpInfos,!*SymbolTable) -> (!.[Ident],!(!*ExplImpInfos,!*SymbolTable))
updateExplImpForMarkedSymbol :: !Index !Declaration !SymbolTableEntry !u:{#DclModule} !*ExplImpInfos !*SymbolTable
......
......@@ -8,6 +8,17 @@ import syntax, typesupport, parse, checksupport, utilities, checktypes, transfor
cUndef :== (-1)
implies a b :== not a || b
:: *ExplImpInfos :== *{#*{!*ExplImpInfo}}
:: ExplImpInfo = ExplImpInfo Ident !.DeclaringModulesSet
:: DeclaringModulesSet :== IntKeyHashtable DeclarationInfo
:: DeclarationInfo =
{ di_decl :: !Declaration
, di_belonging :: !NumberSet
}
:: ImportNrAndIdents =
{ ini_symbol_nr :: !Index
, ini_imp_decl :: !ImportDeclaration
......@@ -19,6 +30,18 @@ implies a b :== not a || b
, si_implicit :: ![(ModuleN, Position)]
}
idents_to_empty_ExplImpInfo_array :: ![Ident] -> *{!*ExplImpInfo}
idents_to_empty_ExplImpInfo_array expl_imp_symbols_in_component
= {ExplImpInfo expl_imp_symbol ikhEmpty \\ expl_imp_symbol <- expl_imp_symbols_in_component}
addDeclarationWithAllBelongingsToExplImpInfo :: !Declaration !BelongingSymbols !Index !ComponentNrAndIndex !ExplImpInfos -> ExplImpInfos
addDeclarationWithAllBelongingsToExplImpInfo decl all_belong_s mod_index {cai_component_nr,cai_index} expl_imp_infos
# (ExplImpInfo eii_ident eii_declaring_modules, expl_imp_infos) = expl_imp_infos![cai_component_nr,cai_index]
di_belonging = nsFromTo (nrOfBelongingSymbols all_belong_s)
di = {di_decl=decl, di_belonging=di_belonging}
eii_declaring_modules = ikhInsert` False mod_index di eii_declaring_modules
= {expl_imp_infos & [cai_component_nr,cai_index] = ExplImpInfo eii_ident eii_declaring_modules}
markExplImpSymbols :: !Int !*(!*ExplImpInfos,!*SymbolTable) -> (!.[Ident],!(!*ExplImpInfos,!*SymbolTable))
markExplImpSymbols component_nr (expl_imp_info, cs_symbol_table)
# (expl_imp_info_from_component,expl_imp_info) = expl_imp_info![component_nr]
......@@ -519,7 +542,7 @@ instance toString STE_Kind where
toString (STE_Field _) = "field"
toString STE_Class = "class"
toString STE_Member = "class member"
toString STE_Generic = "generic" //AA
toString STE_Generic = "generic"
toString STE_Instance = "instance"
toString ste = "<<unknown symbol kind>>"
......
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