Commit 9e97bba4 authored by John van Groningen's avatar John van Groningen
Browse files

remove support for 1.3 import syntax

parent 519c9477
......@@ -1282,8 +1282,8 @@ where
= (inc decl_index, [Declaration { decl_ident = class_ident, decl_pos = class_pos, decl_kind = STE_Class, decl_index = decl_index } : decls])
member_def_to_dcl {me_ident, me_pos} (decl_index, decls)
= (inc decl_index, [Declaration { decl_ident = me_ident, decl_pos = me_pos, decl_kind = STE_Member, decl_index = decl_index } : decls])
instance_def_to_dcl {ins_class, ins_ident, ins_pos} (decl_index, decls)
= (inc decl_index, [Declaration { decl_ident = ins_ident, decl_pos = ins_pos, decl_kind = STE_Instance ins_class.glob_object.ds_ident, decl_index = decl_index } : decls])
instance_def_to_dcl {ins_ident, ins_pos} (decl_index, decls)
= (inc decl_index, [Declaration { decl_ident = ins_ident, decl_pos = ins_pos, decl_kind = STE_Instance, decl_index = decl_index } : decls])
generic_def_to_dcl {gen_ident, gen_member_ident, gen_type, gen_pos} (decl_index, decls)
# generic_decl = Declaration { decl_ident = gen_ident, decl_pos = gen_pos, decl_kind = STE_Generic, decl_index = decl_index }
# member_decl = Declaration { decl_ident = gen_member_ident, decl_pos = gen_pos, decl_kind = STE_Generic, decl_index = decl_index }
......@@ -1463,7 +1463,7 @@ renumber_icl_definitions_as_dcl_definitions (Yes icl_to_dcl_index_table) icl_siz
# class_def = {class_def & class_members=class_members}
# cdefs = {cdefs & com_class_defs.[decl_index] =class_def}
= (Declaration {icl_decl_symbol & decl_index=icl_to_dcl_index_table.[cClassDefs,decl_index]},cdefs)
renumber_icl_decl_symbol (Declaration icl_decl_symbol=:{decl_kind = STE_Instance _, decl_index}) cdefs
renumber_icl_decl_symbol (Declaration icl_decl_symbol=:{decl_kind = STE_Instance, decl_index}) cdefs
= (Declaration {icl_decl_symbol & decl_index=icl_to_dcl_index_table.[cInstanceDefs,decl_index]},cdefs)
renumber_icl_decl_symbol (Declaration icl_decl_symbol=:{decl_kind = STE_Generic, decl_index}) cdefs
= (Declaration {icl_decl_symbol & decl_index=icl_to_dcl_index_table.[cGenericDefs,decl_index]},cdefs)
......@@ -1888,8 +1888,6 @@ checkDclModules imports_of_icl_mod dcl_modules icl_functions macro_defs heaps cs
({ste_index}, cs_symbol_table) = readPtr import_module.id_info cs_symbol_table
= (expl_imp_symbols_accu, nr_of_expl_imp_symbols, [(ste_index, import_file_position, expl_imp_indices):expl_imp_indices_accu], cs_symbol_table)
get_expl_imp_symbol imp_decl=:(ID_OldSyntax idents) state
= foldSt (get_symbol imp_decl) idents state
get_expl_imp_symbol imp_decl state
= get_symbol imp_decl (get_ident imp_decl) state
where
......@@ -1939,23 +1937,7 @@ checkDclComponent components_array super_components expl_imp_indices mod_indices
_ -> True
cs_error
= fold2St check_whether_module_imports_itself expl_imp_indices mod_indices cs.cs_error
cs_error
= case switch_import_syntax is_on_cycle False of
True
# ident_pos
= { ip_ident = dcl_name_of_first_mod_in_component, ip_line = 1,
ip_file = dcl_name_of_first_mod_in_component.id_name }
cs_error
= pushErrorAdmin ident_pos cs_error
cs_error
= checkError
"cyclic module dependencies not allowed in conjunction with Clean 1.3 import syntax" ""
cs_error
-> popErrorAdmin cs_error
_
-> cs_error
cs
= { cs & cs_error = cs_error }
cs = { cs & cs_error = cs_error }
| not cs.cs_error.ea_ok
-> (component_nr-1, expl_imp_infos, dcl_modules, icl_functions, macro_defs, heaps, cs)
# (expl_imp_infos, dcl_modules, cs)
......@@ -2040,9 +2022,7 @@ checkDclComponent components_array super_components expl_imp_indices mod_indices
# (dcls_local_for_import, dcl_modules)
= dcl_modules![mod_index].dcl_declared.dcls_local_for_import
(dcl_modules, expl_imp_infos, cs_symbol_table)
= foldlArraySt ((switch_import_syntax
update_expl_imp_for_marked_symbol
update_expl_imp_for_marked_local_symbol) mod_index)
= foldlArraySt (update_expl_imp_for_marked_local_symbol mod_index)
dcls_local_for_import (dcl_modules, expl_imp_infos, cs_symbol_table)
= (expl_imp_infos, dcl_modules, cs_symbol_table)
......@@ -3090,58 +3070,9 @@ addImportedSymbolsToSymbolTable importing_mod opt_macro_range modules_in_compone
# (not_already_imported, cs)
= add_declaration_to_symbol_table opt_dcl_macro_range declaration importing_mod cs
| not_already_imported
# (consequence_declarations, dcl_modules, cs)
= switch_import_syntax
(add_consequences_to_symbol_table importing_mod declaration dcl_modules cs)
([], dcl_modules, cs)
= (consequence_declarations++[declaration:decls_accu], dcl_modules, cs)
= ([declaration:decls_accu], dcl_modules, cs)
= (decls_accu, dcl_modules, cs)
// this function is for old syntax only
add_consequences_to_symbol_table _ (Declaration {decl_kind=STE_FunctionOrMacro _}) dcl_modules cs
= ([], dcl_modules, cs)
add_consequences_to_symbol_table importing_mod (Declaration {decl_index, decl_kind=STE_Imported ste_kind mod_index}) dcl_modules cs
= add_consequences importing_mod decl_index ste_kind mod_index dcl_modules cs
where
add_consequences _ decl_index STE_Type mod_index dcl_modules cs
# (td=:{td_rhs}, dcl_modules)
= dcl_modules![mod_index].dcl_common.com_type_defs.[decl_index]
= case td_rhs of
RecordType {rt_fields}
-> foldlArraySt (add_field importing_mod mod_index) rt_fields ([], dcl_modules, cs)
_
-> ([], dcl_modules, cs)
add_consequences importing_mod decl_index STE_Class mod_index dcl_modules cs
# (cd=:{class_members}, dcl_modules)
= dcl_modules![mod_index].dcl_common.com_class_defs.[decl_index]
= foldlArraySt (add_member importing_mod mod_index) class_members ([], dcl_modules, cs)
add_consequences _ decl_index _ mod_index dcl_modules cs
= ([], dcl_modules, cs)
add_field importing_mod mod_index {fs_index} (declarations_accu, dcl_modules, cs)
# (sd=:{sd_ident, sd_field, sd_pos}, dcl_modules)
= dcl_modules![mod_index].dcl_common.com_selector_defs.[fs_index]
declaration
= Declaration { decl_ident = sd_field, decl_pos = sd_pos,
decl_kind = STE_Imported (STE_Field sd_ident) mod_index, decl_index = fs_index }
(is_new, cs)
= add_declaration_to_symbol_table No declaration importing_mod cs
| is_new
= ([declaration:declarations_accu], dcl_modules, cs)
= (declarations_accu, dcl_modules, cs)
add_member importing_mod mod_index {ds_ident, ds_index} (declarations_accu, dcl_modules, cs)
# (sd=:{me_ident, me_pos}, dcl_modules)
= dcl_modules![mod_index].dcl_common.com_member_defs.[ds_index]
declaration
= Declaration { decl_ident = me_ident, decl_pos = me_pos,
decl_kind = STE_Imported STE_Member mod_index, decl_index = ds_index }
(is_new, cs)
= add_declaration_to_symbol_table No declaration importing_mod cs
| is_new
= ([declaration:declarations_accu], dcl_modules, cs)
= (declarations_accu, dcl_modules, cs)
add_declaration_to_symbol_table opt_dcl_macro_range (Declaration {decl_kind=STE_FunctionOrMacro _, decl_ident, decl_index}) _ cs
= addImportedFunctionOrMacro opt_dcl_macro_range decl_ident decl_index 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
......@@ -3152,16 +3083,6 @@ updateExplImpInfo :: [Int] Index {!Declaration} {!Declaration} u:{#DclModule} {!
updateExplImpInfo super_components mod_index dcls_import dcls_local_for_import dcl_modules expl_imp_infos cs_symbol_table
# (changed_symbols, (expl_imp_infos, cs_symbol_table))
= mapSt markExplImpSymbols super_components (expl_imp_infos, cs_symbol_table)
cs_symbol_table
= switch_import_syntax
(foldlArraySt opt_store_instance_with_class_symbol dcls_local_for_import cs_symbol_table)
cs_symbol_table
cs_symbol_table
= switch_import_syntax
(foldlArraySt opt_store_instance_with_class_symbol dcls_import cs_symbol_table)
cs_symbol_table
(dcl_modules, expl_imp_infos, cs_symbol_table)
= update_expl_imp_for_marked_symbols mod_index dcls_local_for_import (dcl_modules, expl_imp_infos, cs_symbol_table)
(dcl_modules, expl_imp_infos, cs_symbol_table)
......@@ -3176,40 +3097,21 @@ updateExplImpInfoForCachedModule super_components mod_index dcls_import dcls_loc
# (changed_symbols, (expl_imp_infos, cs_symbol_table))
= mapSt markExplImpSymbols super_components (expl_imp_infos, cs_symbol_table)
dcl_modules13 = dcl_modules
cs_symbol_table13 = cs_symbol_table
dcl_modules__cs_symbol_table = mark_belongings_of_expl_imp_symbols dcls_local_for_import (dcl_modules, cs_symbol_table)
(dcl_modules, cs_symbol_table) = mark_belongings_of_expl_imp_symbols dcls_import dcl_modules__cs_symbol_table
cs_symbol_table = mark_belongings_of_expl_imp_symbols_as_exported dcls_local_for_import cs_symbol_table
cs_symbol_table = mark_belongings_of_expl_imp_symbols_as_exported dcls_import cs_symbol_table
cs_symbol_table = switch_import_syntax cs_symbol_table13 cs_symbol_table
dcl_modules = switch_import_syntax dcl_modules13 dcl_modules
cs_symbol_table
= switch_import_syntax
(foldlArraySt opt_store_instance_with_class_symbol dcls_local_for_import cs_symbol_table)
cs_symbol_table
cs_symbol_table
= switch_import_syntax
(foldlArraySt opt_store_instance_with_class_symbol dcls_import cs_symbol_table)
cs_symbol_table
(dcl_modules, expl_imp_infos, cs_symbol_table)
= update_expl_imp_for_marked_symbols mod_index dcls_local_for_import (dcl_modules, expl_imp_infos, cs_symbol_table)
(dcl_modules, expl_imp_infos, cs_symbol_table)
= update_expl_imp_for_marked_symbols mod_index dcls_import (dcl_modules, expl_imp_infos, cs_symbol_table)
dcl_modules__cs_symbol_table
= switch_import_syntax
= unmark_belongings_of_expl_imp_symbols dcls_local_for_import (dcl_modules, cs_symbol_table)
(dcl_modules, cs_symbol_table)
(unmark_belongings_of_expl_imp_symbols dcls_local_for_import (dcl_modules, cs_symbol_table))
(dcl_modules, cs_symbol_table)
= switch_import_syntax
dcl_modules__cs_symbol_table
(unmark_belongings_of_expl_imp_symbols dcls_import dcl_modules__cs_symbol_table)
= unmark_belongings_of_expl_imp_symbols dcls_import dcl_modules__cs_symbol_table
cs_symbol_table = foldSt (\l cs_symbol_table->foldSt restoreHeap l cs_symbol_table) changed_symbols cs_symbol_table
= (expl_imp_infos, dcl_modules, cs_symbol_table)
......@@ -3295,7 +3197,7 @@ ste_kind_to_string ste_kind = case ste_kind of
-> "STE_Class"
STE_Member
-> "STE_Member"
STE_Instance _
STE_Instance
-> "STE_Instance"
STE_Variable _
-> "STE_Variable"
......@@ -3330,14 +3232,6 @@ ste_kind_to_string ste_kind = case ste_kind of
STE_BelongingSymbol _
-> "STE_BelongingSymbol"
*/
opt_store_instance_with_class_symbol decl=:(Declaration {decl_kind=STE_Imported (STE_Instance class_ident) _}) cs_symbol_table
/* This function is only for old import syntax.
All declared instances for a class have to be collected
*/
= optStoreInstanceWithClassSymbol decl class_ident cs_symbol_table
opt_store_instance_with_class_symbol _ cs_symbol_table
= cs_symbol_table
update_expl_imp_for_marked_symbols mod_index decls (dcl_modules, expl_imp_infos, cs_symbol_table)
= foldlArraySt (update_expl_imp_for_marked_symbol mod_index) decls (dcl_modules, expl_imp_infos, cs_symbol_table)
......
......@@ -17,7 +17,7 @@ where
toInt STE_Generic = cGenericDefs
toInt STE_GenericCase = cGenericCaseDefs
toInt STE_Member = cMemberDefs
toInt (STE_Instance _) = cInstanceDefs
toInt STE_Instance = cInstanceDefs
toInt STE_DclFunction = cFunctionDefs
toInt (STE_FunctionOrMacro _) = cMacroDefs
toInt (STE_DclMacroOrLocalMacroFunction _)= cMacroDefs
......
definition module compilerSwitches
switch_import_syntax one_point_three two_point_zero :== two_point_zero
/* when finally removing this switch also remove the argument of STE_Instance and ID_OldSyntax */
SwitchPreprocessor preprocessor no_preprocessor :== preprocessor
SwitchGenerics on off :== on
......
......@@ -19,8 +19,6 @@ markExplImpSymbols :: !Int !*(!*{!*{!u:ExplImpInfo}}, !*SymbolTable)
updateExplImpForMarkedSymbol :: !Index !Declaration !SymbolTableEntry !u:{#DclModule} !{!{!*ExplImpInfo}} !*SymbolTable
-> (!u:{#DclModule}, !{!{!.ExplImpInfo}}, !.SymbolTable)
optStoreInstanceWithClassSymbol :: Declaration !Ident !*SymbolTable -> .SymbolTable
solveExplicitImports :: !(IntKeyHashtable [(Int,Position,[ImportNrAndIdents])]) !{#Int} !Index
!*(!v:{#DclModule},!*{#Int},!{!*ExplImpInfo},!*CheckState)
-> (!.SolvedImports,! (!v:{#DclModule},!.{#Int},!{!.ExplImpInfo},!.CheckState))
......
......@@ -80,21 +80,6 @@ addExplImpInfo mod_index decl instances { cai_component_nr, cai_index } (dcl_mod
, cs_symbol_table
)
optStoreInstanceWithClassSymbol :: Declaration !Ident !*SymbolTable -> .SymbolTable
optStoreInstanceWithClassSymbol decl class_ident cs_symbol_table
// this function is only for old syntax
| switch_import_syntax False True
= cs_symbol_table
# (class_ste, cs_symbol_table)
= readPtr class_ident.id_info cs_symbol_table
= case class_ste.ste_kind of
STE_ExplImpComponentNrs component_numbers inst_indices_accu
-> writePtr class_ident.id_info
{ class_ste & ste_kind = STE_ExplImpComponentNrs component_numbers [decl:inst_indices_accu]}
cs_symbol_table
_
-> cs_symbol_table
foldlBelongingSymbols f bs st
:== case bs of
BS_Constructors constructors
......@@ -143,7 +128,7 @@ solveExplicitImports expl_imp_indices_ikh modules_in_component_set importing_mod
imported_symbols
([], [], visited_modules, expl_imp_info)
(expl_imp_info, cs_error)
= (switch_import_syntax check_triples check_singles position) successes imported_symbols
= check_singles position successes imported_symbols
(expl_imp_info, cs.cs_error)
(decl_accu, dcl_modules, visited_modules, expl_imp_info, cs)
= foldSt (solve_belonging position expl_imp_indices_ikh modules_in_component_set importing_mod)
......@@ -281,9 +266,7 @@ solveExplicitImports expl_imp_indices_ikh modules_in_component_set importing_mod
eii_declaring_modules (bitvectResetAll visited_modules)
= case opt_decl of
Yes di=:{di_decl, di_instances}
| switch_import_syntax
True
( case di_decl of
| ( case di_decl of
Declaration {decl_kind}
-> case decl_kind of
STE_Imported STE_Member _
......@@ -396,15 +379,6 @@ solveExplicitImports expl_imp_indices_ikh modules_in_component_set importing_mod
= True
= is_member belong_ident t
check_triples position [False, False, False: t1] [imported_symbol, _, _: t2] (expl_imp_info, cs_error)
# (expl_imp_info, cs_error)
= give_error position imported_symbol (expl_imp_info, cs_error)
= check_triples position t1 t2 (expl_imp_info, cs_error)
check_triples position [_, _, _: t1] [_, _, _: t2] (expl_imp_info, cs_error)
= check_triples position t1 t2 (expl_imp_info, cs_error)
check_triples position [] [] (expl_imp_info, cs_error)
= (expl_imp_info, cs_error)
check_singles position [False: t1] [imported_symbol: t2] (expl_imp_info, cs_error)
# (expl_imp_info, cs_error)
= give_error position imported_symbol (expl_imp_info, cs_error)
......@@ -421,10 +395,7 @@ solveExplicitImports expl_imp_indices_ikh modules_in_component_set importing_mod
= pushErrorAdmin (newPosition import_ident position) cs_error
cs_error
= checkError eii_ident
(switch_import_syntax
"not exported by the specified module"
("not exported as a "+++impDeclToNameSpaceString ini_imp_decl
+++" by the specified module"))
("not exported as a "+++impDeclToNameSpaceString ini_imp_decl +++" by the specified module")
cs_error
= (expl_imp_info, popErrorAdmin cs_error)
......@@ -507,7 +478,7 @@ checkExplicitImportCompleteness dcls_explicit dcl_modules icl_functions macro_de
= check_completeness dcl_common.com_class_defs.[decl_index] cci ccs
continuation STE_Member dcl_common dcl_functions cci ccs
= check_completeness dcl_common.com_member_defs.[decl_index] cci ccs
continuation (STE_Instance _) dcl_common dcl_functions cci ccs
continuation STE_Instance dcl_common dcl_functions cci ccs
= check_completeness dcl_common.com_instance_defs.[decl_index] cci ccs
continuation STE_DclFunction dcl_common dcl_functions cci ccs
= check_completeness dcl_functions.[decl_index] cci ccs
......@@ -536,7 +507,7 @@ instance toString STE_Kind where
toString STE_Class = "class"
toString STE_Member = "class member"
toString STE_Generic = "generic" //AA
toString (STE_Instance _) = "instance"
toString STE_Instance = "instance"
toString ste = "<<unknown symbol kind>>"
check_whether_ident_is_imported :: !Ident !STE_Kind !CheckCompletenessInputBox !*CheckCompletenessStateBox
......
......@@ -1139,24 +1139,6 @@ instance want ImportDeclaration
where
want pState
# (token, pState) = nextToken GeneralContext pState
// MW5..
= (switch_import_syntax want_1_3_import_declaration want_2_0_import_declaration) token pState
want_1_3_import_declaration token pState
= case token of
IdentToken name
# (fun_id, pState) = stringToIdent name IC_Expression pState
(type_id, pState) = stringToIdent name IC_Type pState
(class_id, pState) = stringToIdent name IC_Class pState
-> (ID_OldSyntax [fun_id, type_id, class_id], pState)
token
# (fun_id, pState) = stringToIdent "dummy" IC_Expression pState
-> ( ID_Function { ii_ident = fun_id, ii_extended = False }
, parseError "from import" (Yes token) "imported item" pState
)
want_2_0_import_declaration token pState
// ..MW5
= case token of
DoubleColonToken
# (name, pState) = wantConstructorName "import type" pState
......
......@@ -43,7 +43,7 @@ instance == FunctionOrMacroIndex
| STE_Member
| STE_Generic // AA
| STE_GenericCase // AA
| STE_Instance !Ident // argument: the class (used in explicitimports (1.3 syntax only))
| STE_Instance
| STE_Variable !VarInfoPtr
| STE_TypeVariable !TypeVarInfoPtr
| STE_TypeAttribute !AttrVarInfoPtr
......@@ -397,7 +397,6 @@ instance toString (Import from_symbol), AttributeVar, TypeAttribute, Annotation
| ID_Type !ImportedIdent !(Optional [ImportedIdent])
| ID_Record !ImportedIdent !(Optional [ImportedIdent])
| ID_Instance !ImportedIdent !Ident !(![Type],![TypeContext])
| ID_OldSyntax ![Ident]
cIsImportedLibrary :== True
cIsImportedObject :== False
......
......@@ -906,7 +906,7 @@ where
STE_Member
= file <<< "STE_Member"
(<<<) file
(STE_Instance _)
STE_Instance
= file <<< "STE_Instance"
(<<<) file
(STE_Variable _)
......
......@@ -2261,7 +2261,7 @@ where
collect_imported_instances imports common_defs dummy error class_instances type_var_heap td_infos
= foldSt (collect_imported_instance common_defs) imports (dummy, error, class_instances, type_var_heap, td_infos)
collect_imported_instance common_defs (Declaration {decl_kind = STE_Imported (STE_Instance _) mod_index, decl_index }) state
collect_imported_instance common_defs (Declaration {decl_kind = STE_Imported STE_Instance mod_index, decl_index }) state
= update_instances_of_class common_defs mod_index decl_index state
collect_imported_instance common_defs _ state
= state
......
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