aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--frontend/check.icl88
-rw-r--r--frontend/comparedefimp.dcl4
-rw-r--r--frontend/comparedefimp.icl18
-rw-r--r--frontend/convertimportedtypes.icl56
-rw-r--r--frontend/syntax.dcl2
-rw-r--r--main/compile.icl2
6 files changed, 77 insertions, 93 deletions
diff --git a/frontend/check.icl b/frontend/check.icl
index 544c2ec..76f56bb 100644
--- a/frontend/check.icl
+++ b/frontend/check.icl
@@ -1016,9 +1016,9 @@ gimme_a_strict_array_type :: !u:{!.a} -> v:{!.a}, [u<=v]
gimme_a_strict_array_type a = a
create_icl_to_dcl_index_table :: !ModuleKind !{#Int} !Int !(Optional {#{#Int}}) !*{#DclModule} !*{#FunDef}
- -> (!Optional {#{#Int}},!Optional {#{#Int}}, !.{#DclModule},!*{#FunDef})
+ -> (!Optional {#{#Int}},!Optional {#Int},!Optional {#{#Int}}, !.{#DclModule},!*{#FunDef})
create_icl_to_dcl_index_table MK_Main icl_sizes main_dcl_module_n dcl_conversions modules fun_defs
- = (No,No,modules,fun_defs)
+ = (No,No,No,modules,fun_defs)
create_icl_to_dcl_index_table _ icl_sizes main_dcl_module_n old_conversions modules fun_defs
#! (size_icl_functions,fun_defs) = usize fun_defs
#! icl_sizes = make_icl_sizes
@@ -1029,8 +1029,7 @@ create_icl_to_dcl_index_table _ icl_sizes main_dcl_module_n old_conversions modu
#! dictionary_info=dcl_mod.dcl_dictionary_info
# (Yes conversion_table) = old_conversions
#! icl_to_dcl_index_table = {create_icl_to_dcl_index_table_for_kind table_size dcl_to_icl_table table_kind dictionary_info \\ table_kind<-[0..] & table_size <-: icl_sizes & dcl_to_icl_table <-: conversion_table }
- #! modules = {modules & [main_dcl_module_n].dcl_macro_conversions=Yes conversion_table.[cMacroDefs]}
- = (Yes icl_to_dcl_index_table,old_conversions,modules,fun_defs)
+ = (Yes icl_to_dcl_index_table,Yes conversion_table.[cMacroDefs],old_conversions,modules,fun_defs)
recompute_icl_to_dcl_index_table_for_functions No dcl_icl_conversions n_functions
= No
@@ -1211,7 +1210,7 @@ combineDclAndIclModule MK_Main modules icl_decl_symbols macro_and_function_local
= ({ copied_type_defs = {}, copied_class_defs = {}, copied_generic_defs = {}}, No, modules, icl_decl_symbols, macro_and_function_local_defs, icl_definitions, icl_sizes, cs)
combineDclAndIclModule _ modules icl_decl_symbols macro_and_function_local_defs icl_definitions icl_sizes cs
#! main_dcl_module_n=cs.cs_x.x_main_dcl_module_n
- # (dcl_mod=:{dcl_declared={dcls_local},dcl_macros, dcl_sizes, dcl_common}, modules) = modules![main_dcl_module_n]
+ # ({dcl_declared={dcls_local},dcl_macros, dcl_sizes, dcl_common}, modules) = modules![main_dcl_module_n]
cs = addGlobalDefinitionsToSymbolTable icl_decl_symbols cs
cs = addGlobalDefinitionsToSymbolTable macro_and_function_local_defs cs
@@ -1241,7 +1240,7 @@ combineDclAndIclModule _ modules icl_decl_symbols macro_and_function_local_defs
, copied_generic_defs = copied_generic_defs
}
, Yes conversion_table
- , { modules & [main_dcl_module_n] = { dcl_mod & dcl_macro_conversions = Yes conversion_table.[cMacroDefs] }}
+ , {modules & [main_dcl_module_n].dcl_has_macro_conversions = True}
, icl_decl_symbols, macro_and_function_local_defs
, { icl_definitions
& def_types = my_append icl_definitions.def_types new_type_defs
@@ -1427,15 +1426,15 @@ where
my_append front back
= front ++ back
-replace_icl_macros_by_dcl_macros :: ModuleKind IndexRange [Declaration] *{#DclModule} *CheckState -> (![Declaration],!*{#DclModule},!*CheckState);
-replace_icl_macros_by_dcl_macros MK_Main icl_macro_index_range decls dcl_modules cs
+replace_icl_macros_by_dcl_macros :: ModuleKind IndexRange (Optional {#Int}) [Declaration] *{#DclModule} *CheckState -> (![Declaration],!*{#DclModule},!*CheckState);
+replace_icl_macros_by_dcl_macros MK_Main icl_macro_index_range optional_macro_conversions decls dcl_modules cs
= (decls,dcl_modules,cs)
-replace_icl_macros_by_dcl_macros _ {ir_from=first_icl_macro_index,ir_to=end_icl_macro_index} decls dcl_modules cs
+replace_icl_macros_by_dcl_macros _ {ir_from=first_icl_macro_index,ir_to=end_icl_macro_index} optional_macro_conversions decls dcl_modules cs
#! main_dcl_module_n=cs.cs_x.x_main_dcl_module_n
- # ({dcl_macros={ir_from=first_macro_n},dcl_macro_conversions},dcl_modules) = dcl_modules![main_dcl_module_n]
- | case dcl_macro_conversions of No -> True ; _ -> False
+ # ({dcl_macros={ir_from=first_macro_n},dcl_has_macro_conversions},dcl_modules) = dcl_modules![main_dcl_module_n]
+ | not dcl_has_macro_conversions
= (decls,dcl_modules,cs)
- # (Yes dcl_to_icl_table) = dcl_macro_conversions
+ # (Yes dcl_to_icl_table) = optional_macro_conversions
# macro_renumber_table = create_icl_to_dcl_index_table_for_macros dcl_to_icl_table
with
create_icl_to_dcl_index_table_for_macros :: !{#Int} -> {#Int}
@@ -1459,7 +1458,6 @@ replace_icl_macros_by_dcl_macros _ {ir_from=first_icl_macro_index,ir_to=end_icl_
# dcl_n=macro_renumber_table.[decl_index-first_icl_macro_index]
# decls = replace_icl_macros_by_dcl_macros decls;
| decl_index>=first_icl_macro_index && decl_index<end_icl_macro_index && dcl_n<>NoIndex
-// | trace_tn ("replace_icl_macros_by_dcl_macros "+++toString decl_record.decl_ident+++" "+++toString decl_index+++" "+++toString (first_macro_n+dcl_n))
= [Declaration {decl_record & decl_kind=STE_DclMacroOrLocalMacroFunction [], decl_index=first_macro_n+dcl_n} : decls]
= [decl : decls]
replace_icl_macros_by_dcl_macros [decl:decls]
@@ -1777,13 +1775,14 @@ checkDclModuleWithinComponent dcl_imported_module_numbers component_nr is_on_cyc
renumber_icl_module :: ModuleKind IndexRange IndexRange IndexRange IndexRange Index Int {#Int} (Optional {#{#Int}}) IndexRange
*{#FunDef} *CommonDefs [Declaration] [Declaration] *{#DclModule} *ErrorAdmin
- -> (![IndexRange],![IndexRange],![IndexRange], ![IndexRange], !Int,!Index,!IndexRange,
+ -> (![IndexRange],![IndexRange],![IndexRange], ![IndexRange], !Int,!Index,!IndexRange,Optional {#Index},
!*{#FunDef},!*CommonDefs,![Declaration],![Declaration],!*{#DclModule}, *ErrorAdmin);
-renumber_icl_module mod_type icl_global_function_range icl_instance_range icl_generic_range icl_type_fun_range nr_of_functions main_dcl_module_n icl_sizes dcl_conversions def_macro_indices icl_functions icl_common local_defs macro_and_function_local_defs dcl_modules error
- # (optional_icl_to_dcl_index_table,optional_old_conversion_table,dcl_modules,icl_functions)
+renumber_icl_module mod_type icl_global_function_range icl_instance_range icl_generic_range icl_type_fun_range nr_of_functions main_dcl_module_n icl_sizes dcl_conversions def_macro_indices
+ icl_functions icl_common local_defs macro_and_function_local_defs dcl_modules error
+ # (optional_icl_to_dcl_index_table,optional_macro_conversions,optional_old_conversion_table,dcl_modules,icl_functions)
= create_icl_to_dcl_index_table mod_type icl_sizes main_dcl_module_n dcl_conversions dcl_modules icl_functions
# (dcl_mod, dcl_modules) = dcl_modules![main_dcl_module_n]
- # icl_functions = add_dummy_specialized_functions mod_type dcl_mod icl_functions
+ # icl_functions = add_dummy_specialized_functions mod_type dcl_mod.dcl_specials icl_functions
# class_instances = icl_common.com_instance_defs
# gencase_defs = icl_common.com_gencase_defs
# type_defs = icl_common.com_type_defs
@@ -1791,9 +1790,8 @@ renumber_icl_module mod_type icl_global_function_range icl_instance_range icl_ge
= add_dcl_instances_to_conversion_table
optional_old_conversion_table nr_of_functions dcl_mod class_instances gencase_defs type_defs error
| not error.ea_ok
- = ([],[],[],[], 0,0,def_macro_indices,icl_functions,
- {icl_common & com_instance_defs=class_instances, com_gencase_defs=gencase_defs,
- com_type_defs=type_defs},
+ = ([],[],[],[], 0,0,def_macro_indices,optional_macro_conversions,icl_functions,
+ {icl_common & com_instance_defs=class_instances, com_gencase_defs=gencase_defs, com_type_defs=type_defs},
local_defs,macro_and_function_local_defs,dcl_modules,error)
# (n_functions,icl_functions) = usize icl_functions
# optional_icl_to_dcl_index_table = recompute_icl_to_dcl_index_table_for_functions optional_icl_to_dcl_index_table dcl_icl_conversions n_functions
@@ -1822,13 +1820,13 @@ renumber_icl_module mod_type icl_global_function_range icl_instance_range icl_ge
# local_functions_index_offset = n_dcl_instances + n_dcl_gencases + n_dcl_specials + n_dcl_type_funs
- # dcl_mod = case dcl_mod of
- dcl_mod=:{dcl_macro_conversions=Yes conversion_table}
+ # optional_macro_conversions
+ = case optional_macro_conversions of
+ Yes conversion_table
# new_macro_conversions = {if (old_icl_macro_index==(-1)) old_icl_macro_index (old_icl_macro_index+local_functions_index_offset) \\ old_icl_macro_index<-:conversion_table}
- -> {dcl_mod & dcl_macro_conversions=Yes new_macro_conversions}
- dcl_mod
- -> dcl_mod
- # dcl_modules = {dcl_modules & [main_dcl_module_n]=dcl_mod}
+ -> Yes new_macro_conversions
+ No
+ -> No
# n_global_functions=icl_global_function_range.ir_to
# n_not_exported_global_functions=n_global_functions-n_exported_global_functions
@@ -1869,11 +1867,12 @@ renumber_icl_module mod_type icl_global_function_range icl_instance_range icl_ge
# icl_ranges =
[icl_global, not_exported_instance_range, not_exported_generic_range]
- = (icl_global_functions_ranges, icl_instances_ranges, icl_generic_ranges, icl_type_fun_ranges, n_exported_global_functions,local_functions_index_offset,def_macro_indices,icl_functions,icl_common,local_defs,macro_and_function_local_defs,dcl_modules, error)
+ = (icl_global_functions_ranges, icl_instances_ranges, icl_generic_ranges, icl_type_fun_ranges, n_exported_global_functions,local_functions_index_offset,def_macro_indices,optional_macro_conversions,
+ icl_functions,icl_common,local_defs,macro_and_function_local_defs,dcl_modules, error)
where
add_dummy_specialized_functions MK_Main dcl_mod icl_functions
= icl_functions
- add_dummy_specialized_functions _ {dcl_specials={ir_from,ir_to}} icl_functions
+ add_dummy_specialized_functions _ {ir_from,ir_to} icl_functions
# n_specials = ir_to-ir_from
| n_specials==0
= icl_functions
@@ -1883,17 +1882,15 @@ renumber_icl_module mod_type icl_global_function_range icl_instance_range icl_ge
add_dcl_instances_to_conversion_table :: (Optional {#{#Int}}) !Index !DclModule !*{# ClassInstance} !*{# GenericCaseDef} !*{# CheckedTypeDef} *ErrorAdmin
-> (!*Optional *{#Index},!*{# ClassInstance}, !*{# GenericCaseDef}, !*{# CheckedTypeDef},*ErrorAdmin)
add_dcl_instances_to_conversion_table optional_old_conversion_table first_free_index
- dcl_mod=:{dcl_specials,dcl_functions,dcl_common,dcl_macro_conversions,dcl_type_funs}
+ {dcl_specials,dcl_functions,dcl_common,dcl_has_macro_conversions,dcl_type_funs}
icl_instances icl_gencases icl_type_defs error
- = case dcl_macro_conversions of
- Yes _
- # (new_conversion_table, icl_instances, icl_gencases, icl_type_defs, error)
- = build_conversion_table_for_instances_of_dcl_mod dcl_specials first_free_index optional_old_conversion_table
- dcl_functions dcl_common.com_instance_defs icl_instances dcl_common.com_gencase_defs icl_gencases
- dcl_common.com_type_defs icl_type_defs error
- -> (Yes new_conversion_table,icl_instances, icl_gencases, icl_type_defs, error)
- No
- -> (No, icl_instances, icl_gencases, icl_type_defs, error)
+ | dcl_has_macro_conversions
+ # (new_conversion_table, icl_instances, icl_gencases, icl_type_defs, error)
+ = build_conversion_table_for_instances_of_dcl_mod dcl_specials first_free_index optional_old_conversion_table
+ dcl_functions dcl_common.com_instance_defs icl_instances dcl_common.com_gencase_defs icl_gencases
+ dcl_common.com_type_defs icl_type_defs error
+ = (Yes new_conversion_table,icl_instances, icl_gencases, icl_type_defs, error)
+ = (No, icl_instances, icl_gencases, icl_type_defs, error)
where
build_conversion_table_for_instances_of_dcl_mod dcl_specials=:{ir_from,ir_to} first_free_index optional_old_conversion_table dcl_functions
dcl_instances icl_instances dcl_gencases icl_gencases dcl_types icl_type_defs error
@@ -2186,8 +2183,10 @@ check_module2 mod_ident mod_modification_time mod_imported_objects mod_imports m
# (nr_of_functions, icl_functions) = usize icl_functions
# def_macro_indices=cdefs.def_macro_indices
- # (icl_global_functions_ranges,icl_instances_ranges,icl_generic_ranges,icl_type_fun_ranges,n_exported_global_functions,local_functions_index_offset,def_macro_indices,icl_functions,icl_common,local_defs,macro_and_function_local_defs,dcl_modules, error)
- = renumber_icl_module mod_type icl_global_function_range icl_instance_range icl_generic_range icl_type_fun_range nr_of_functions main_dcl_module_n icl_sizes dcl_conversions def_macro_indices icl_functions icl_common local_defs macro_and_function_local_defs dcl_modules cs.cs_error
+ # (icl_global_functions_ranges,icl_instances_ranges,icl_generic_ranges,icl_type_fun_ranges,n_exported_global_functions,local_functions_index_offset,def_macro_indices,optional_macro_conversions,
+ icl_functions,icl_common,local_defs,macro_and_function_local_defs,dcl_modules, error)
+ = renumber_icl_module mod_type icl_global_function_range icl_instance_range icl_generic_range icl_type_fun_range nr_of_functions main_dcl_module_n icl_sizes dcl_conversions def_macro_indices
+ icl_functions icl_common local_defs macro_and_function_local_defs dcl_modules cs.cs_error
| not error.ea_ok
= (False, abort "evaluated error 3 (check.icl)", {}, {}, {}, cs.cs_x.x_main_dcl_module_n,heaps, cs.cs_predef_symbols, cs.cs_symbol_table, error.ea_file, [])
@@ -2213,7 +2212,8 @@ check_module2 mod_ident mod_modification_time mod_imported_objects mod_imports m
// maps the module indices of all modules in the actual component to all explicit
// imports of that module
- (macro_and_function_local_defs,dcl_modules,cs) = replace_icl_macros_by_dcl_macros mod_type def_macro_indices macro_and_function_local_defs dcl_modules cs
+ (macro_and_function_local_defs,dcl_modules,cs)
+ = replace_icl_macros_by_dcl_macros mod_type def_macro_indices optional_macro_conversions macro_and_function_local_defs dcl_modules cs
cs = addGlobalDefinitionsToSymbolTable local_defs cs
cs = addGlobalDefinitionsToSymbolTable macro_and_function_local_defs cs
@@ -2234,7 +2234,7 @@ check_module2 mod_ident mod_modification_time mod_imported_objects mod_imports m
(_,icl_common, dcl_modules, heaps=:{hp_var_heap, hp_type_heaps}, cs)
= checkCommonDefinitions (Yes (copied_dcl_defs, nr_of_cached_modules)) main_dcl_module_n icl_common dcl_modules heaps cs
-
+
(instance_types, icl_common, dcl_modules, hp_var_heap, hp_type_heaps, cs)
= checkIclInstances main_dcl_module_n icl_common dcl_modules hp_var_heap hp_type_heaps cs
@@ -2310,7 +2310,7 @@ check_module2 mod_ident mod_modification_time mod_imported_objects mod_imports m
(main_dcl_module, dcl_modules) = dcl_modules![main_dcl_module_n]
(icl_mod, macro_defs, heaps, cs_error)
- = compareDefImp main_dcl_module_n main_dcl_module n_exported_global_functions icl_mod e_info.ef_macro_defs heaps cs_error
+ = compareDefImp main_dcl_module_n main_dcl_module optional_macro_conversions n_exported_global_functions icl_mod e_info.ef_macro_defs heaps cs_error
# (predef_symbols_for_transform, cs_predef_symbols) = get_predef_symbols_for_transform cs_predef_symbols
(groups, icl_functions, macro_defs, var_heap, expr_heap, cs_symbol_table, cs_error)
@@ -2674,7 +2674,7 @@ initialDclModule ({mod_ident, mod_modification_time, mod_defs=mod_defs=:{def_fun
, dcls_local = all_defs
, dcls_local_for_import = {local_declaration_for_import decl module_n \\ decl<-all_defs}
}
- , dcl_macro_conversions = No
+ , dcl_has_macro_conversions = False
, dcl_module_kind = mod_type
, dcl_modification_time = mod_modification_time
, dcl_imported_module_numbers = EndNumbers
diff --git a/frontend/comparedefimp.dcl b/frontend/comparedefimp.dcl
index 15d59ca..cf9492c 100644
--- a/frontend/comparedefimp.dcl
+++ b/frontend/comparedefimp.dcl
@@ -4,8 +4,8 @@ import syntax, checksupport
// compare definition and implementation module
-compareDefImp :: /*!{#Int}*/ !Int !DclModule !Int !*IclModule !*{#*{#FunDef}} !*Heaps !*ErrorAdmin
- -> (!.IclModule,!.{#.{#FunDef}},!.Heaps,!.ErrorAdmin)
+compareDefImp :: !Int !DclModule !(Optional {#Index}) !Int !*IclModule !*{#*{#FunDef}} !*Heaps !*ErrorAdmin
+ -> (!.IclModule,!.{#.{#FunDef}},!.Heaps,!.ErrorAdmin)
symbolTypesCorrespond :: !SymbolType !SymbolType !*TypeHeaps -> (!ComparisionErrorCode, !.TypeHeaps)
diff --git a/frontend/comparedefimp.icl b/frontend/comparedefimp.icl
index 17f32a7..b1d835f 100644
--- a/frontend/comparedefimp.icl
+++ b/frontend/comparedefimp.icl
@@ -1,6 +1,6 @@
implementation module comparedefimp
-import syntax, checksupport, compare_constructor, utilities, StdCompare, compilerSwitches
+import syntax, checksupport, compare_constructor, utilities, StdCompare
:: CompareState =
{ comp_type_var_heap :: !.TypeVarHeap
@@ -121,7 +121,7 @@ where
# dcl_class_def = dcl_class_defs.[class_index]
(icl_class_def, icl_class_defs) = icl_class_defs![class_index]
# (ok, icl_member_defs, comp_st) = compare_classes dcl_class_def dcl_member_defs icl_class_def icl_member_defs comp_st
- | ok // ---> ("compare_class_defs", dcl_class_def.class_ident, icl_class_def.class_ident)
+ | ok
= (icl_class_defs, icl_member_defs, comp_st)
# comp_error = compareError class_def_error (newPosition icl_class_def.class_ident icl_class_def.class_pos) comp_st.comp_error
= (icl_class_defs, icl_member_defs, { comp_st & comp_error = comp_error })
@@ -168,8 +168,6 @@ where
= (icl_instance_defs, comp_st)
# comp_error = compareError instance_def_error (newPosition icl_instance_def.ins_ident icl_instance_def.ins_pos) comp_st.comp_error
= (icl_instance_defs, { comp_st & comp_error = comp_error })
-// ---> ("compare_instance_defs", dcl_instance_def.ins_ident, dcl_instance_def.ins_type, icl_instance_def.ins_ident, icl_instance_def.ins_type)
-
compareGenericDefs :: !{# Int} !{#Bool} !{# GenericDef} !u:{# GenericDef} !*CompareState -> (!u:{# GenericDef}, !*CompareState)
compareGenericDefs dcl_sizes copied_from_dcl dcl_generic_defs icl_generic_defs comp_st
@@ -333,7 +331,6 @@ where
comp_st = { comp_st & comp_type_var_heap = comp_type_var_heap, comp_attr_var_heap = comp_attr_var_heap }
= compare (dcl_st.st_args, (dcl_st.st_args_strictness, (dcl_st.st_result, (dcl_st.st_context, dcl_st.st_attr_env))))
(icl_st.st_args, (icl_st.st_args_strictness, (icl_st.st_result, (icl_st.st_context, icl_st.st_attr_env)))) comp_st
-// ---> ("compare SymbolType", dcl_st, icl_st)
instance compare InstanceType
where
@@ -342,7 +339,6 @@ where
comp_attr_var_heap = initialyseAttributeVars dcl_it.it_attr_vars icl_it.it_attr_vars comp_attr_var_heap
comp_st = { comp_st & comp_type_var_heap = comp_type_var_heap, comp_attr_var_heap = comp_attr_var_heap }
= compare (dcl_it.it_types, dcl_it.it_context) (icl_it.it_types, icl_it.it_context) comp_st
-// ---> ("compare InstanceType", dcl_it, icl_it)
instance compare TypeContext
where
@@ -423,9 +419,9 @@ CEC_ContextNotOK :== -3
CEC_AttrEnvNotOK :== -4
class t_corresponds a :: !a !a -> *TypesCorrespondMonad
+ // whether two types correspond
class e_corresponds a :: !a !a -> ExpressionsCorrespondMonad
// check for correspondence of expressions
- // whether two types correspond
class getIdentPos a :: a -> IdentPos
@@ -435,11 +431,11 @@ class CorrespondenceNumber a where
initial_hwn hwn_heap = { hwn_heap = hwn_heap, hwn_number = 0 }
-compareDefImp :: !Int !DclModule !Int !*IclModule !*{#*{#FunDef}} !*Heaps !*ErrorAdmin
- -> (!.IclModule,!.{#.{#FunDef}},!.Heaps,!.ErrorAdmin)
-compareDefImp main_dcl_module_n main_dcl_module=:{dcl_macro_conversions=No} n_exported_global_functions icl_module macro_defs heaps error_admin
+compareDefImp :: !Int !DclModule !(Optional {#Index}) !Int !*IclModule !*{#*{#FunDef}} !*Heaps !*ErrorAdmin
+ -> (!.IclModule,!.{#.{#FunDef}},!.Heaps,!.ErrorAdmin)
+compareDefImp main_dcl_module_n main_dcl_module No n_exported_global_functions icl_module macro_defs heaps error_admin
= (icl_module, macro_defs,heaps, error_admin)
-compareDefImp main_dcl_module_n main_dcl_module=:{dcl_macro_conversions=Yes macro_conversion_table} n_exported_global_functions icl_module macro_defs heaps error_admin
+compareDefImp main_dcl_module_n main_dcl_module (Yes macro_conversion_table) n_exported_global_functions icl_module macro_defs heaps error_admin
// | Trace_array icl_module.icl_functions
// && Trace_array macro_defs.[main_dcl_module_n]
diff --git a/frontend/convertimportedtypes.icl b/frontend/convertimportedtypes.icl
index eb9aede..e1ed554 100644
--- a/frontend/convertimportedtypes.icl
+++ b/frontend/convertimportedtypes.icl
@@ -7,25 +7,16 @@ cDontRemoveAnnotations :== False
convertDclModule :: !Int !{# DclModule} !{# CommonDefs} !*{#{# CheckedTypeDef}} !ImportedConstructors !*VarHeap !*TypeHeaps
-> (!*{#{# CheckedTypeDef}}, !ImportedConstructors, !*VarHeap, !*TypeHeaps)
convertDclModule main_dcl_module_n dcl_mods common_defs imported_types imported_conses var_heap type_heaps
- # {dcl_functions,dcl_common=dcl_common=:{com_type_defs,com_cons_defs,com_selector_defs},dcl_macro_conversions} = dcl_mods.[main_dcl_module_n]
- = case dcl_macro_conversions of
- Yes _
- #!(icl_type_defs, imported_types) = imported_types![main_dcl_module_n]
-
- common_defs = { common \\ common <-: common_defs }
- common_defs = { common_defs & [main_dcl_module_n] = dcl_common }
-/*
- // AA: HACK: extend dcl modules with the icl module
- icl_common = common_defs.[main_dcl_module_n]
- common_defs = arrayPlusList common_defs [icl_common]
- common_defs = { common_defs & [main_dcl_module_n] = dcl_common }
-*/
- types_and_heaps = convert_dcl_functions dcl_functions common_defs ( { imported_types & [main_dcl_module_n] = com_type_defs }, imported_conses, var_heap, type_heaps)
- types_and_heaps = convertConstructorTypes com_cons_defs main_dcl_module_n common_defs types_and_heaps
- (imported_types, imported_conses, var_heap, type_heaps) = convertSelectorTypes com_selector_defs main_dcl_module_n common_defs types_and_heaps
- -> ({ imported_types & [main_dcl_module_n] = icl_type_defs}, imported_conses, var_heap, type_heaps)
- No
- -> (imported_types, imported_conses, var_heap, type_heaps)
+ # {dcl_functions,dcl_common=dcl_common=:{com_type_defs,com_cons_defs,com_selector_defs},dcl_has_macro_conversions} = dcl_mods.[main_dcl_module_n]
+ | dcl_has_macro_conversions
+ #!(icl_type_defs, imported_types) = imported_types![main_dcl_module_n]
+ common_defs = { common \\ common <-: common_defs }
+ common_defs = { common_defs & [main_dcl_module_n] = dcl_common }
+ types_and_heaps = convert_dcl_functions dcl_functions common_defs ( { imported_types & [main_dcl_module_n] = com_type_defs }, imported_conses, var_heap, type_heaps)
+ types_and_heaps = convertConstructorTypes com_cons_defs main_dcl_module_n common_defs types_and_heaps
+ (imported_types, imported_conses, var_heap, type_heaps) = convertSelectorTypes com_selector_defs main_dcl_module_n common_defs types_and_heaps
+ = ({ imported_types & [main_dcl_module_n] = icl_type_defs}, imported_conses, var_heap, type_heaps)
+ = (imported_types, imported_conses, var_heap, type_heaps)
where
convert_dcl_functions dcl_functions common_defs types_and_heaps
= iFoldSt (convert_dcl_function dcl_functions common_defs) 0 (size dcl_functions) types_and_heaps
@@ -63,21 +54,18 @@ convertIclModule main_dcl_module_n common_defs imported_types imported_conses va
convertImportedTypeSpecifications :: !Int !{# DclModule} !{# {# FunType} } !{# CommonDefs} !ImportedConstructors !ImportedFunctions
!*{# {#CheckedTypeDef}} !*TypeHeaps !*VarHeap -> (!*{#{#CheckedTypeDef}}, !*TypeHeaps, !*VarHeap)
convertImportedTypeSpecifications main_dcl_module_n dcl_mods dcl_functions common_defs imported_conses imported_functions imported_types type_heaps var_heap
- # {dcl_common={com_type_defs},dcl_macro_conversions} = dcl_mods.[main_dcl_module_n]
- = case dcl_macro_conversions of
- Yes _
- # abstract_type_indexes = iFoldSt (determine_abstract_type com_type_defs) 0 (size com_type_defs) []
- | isEmpty abstract_type_indexes
- -> convert_imported_type_specs dcl_functions common_defs imported_conses imported_functions imported_types type_heaps var_heap
- #!(icl_type_defs, imported_types) = imported_types![main_dcl_module_n]
- type_defs = foldSt insert_abstract_type abstract_type_indexes { icl_type_def \\ icl_type_def <-: icl_type_defs }
- (imported_types, type_heaps, var_heap)
- = convert_imported_type_specs dcl_functions common_defs imported_conses imported_functions
- { imported_types & [main_dcl_module_n] = type_defs } type_heaps var_heap
- -> ({ imported_types & [main_dcl_module_n] = icl_type_defs }, type_heaps, var_heap)
- No
- -> convert_imported_type_specs dcl_functions common_defs imported_conses imported_functions imported_types type_heaps var_heap
-
+ # {dcl_common={com_type_defs},dcl_has_macro_conversions} = dcl_mods.[main_dcl_module_n]
+ | dcl_has_macro_conversions
+ # abstract_type_indexes = iFoldSt (determine_abstract_type com_type_defs) 0 (size com_type_defs) []
+ | isEmpty abstract_type_indexes
+ = convert_imported_type_specs dcl_functions common_defs imported_conses imported_functions imported_types type_heaps var_heap
+ #!(icl_type_defs, imported_types) = imported_types![main_dcl_module_n]
+ type_defs = foldSt insert_abstract_type abstract_type_indexes { icl_type_def \\ icl_type_def <-: icl_type_defs }
+ (imported_types, type_heaps, var_heap)
+ = convert_imported_type_specs dcl_functions common_defs imported_conses imported_functions
+ { imported_types & [main_dcl_module_n] = type_defs } type_heaps var_heap
+ = ({ imported_types & [main_dcl_module_n] = icl_type_defs }, type_heaps, var_heap)
+ = convert_imported_type_specs dcl_functions common_defs imported_conses imported_functions imported_types type_heaps var_heap
where
determine_abstract_type dcl_type_defs type_index abstract_type_indexes
# {td_rhs} = dcl_type_defs.[type_index]
diff --git a/frontend/syntax.dcl b/frontend/syntax.dcl
index b8b2c97..8a4d679 100644
--- a/frontend/syntax.dcl
+++ b/frontend/syntax.dcl
@@ -159,7 +159,7 @@ instance == FunctionOrMacroIndex
, dcl_sizes :: !{# Int}
, dcl_dictionary_info :: !DictionaryInfo
, dcl_declared :: !Declarations
- , dcl_macro_conversions :: !Optional {#Index}
+ , dcl_has_macro_conversions :: !Bool
, dcl_module_kind :: !ModuleKind
, dcl_modification_time:: !{#Char}
, dcl_imported_module_numbers :: !NumberSet
diff --git a/main/compile.icl b/main/compile.icl
index 3127882..e0c022f 100644
--- a/main/compile.icl
+++ b/main/compile.icl
@@ -325,7 +325,7 @@ compileModule options backendArgs cache=:{dcl_modules,functions_and_macros,prede
| not closed
= abort ("couldn't close error file \"" +++ options.errorPath +++ "\"\n")
| success
- # dcl_modules={{dcl_module \\ dcl_module<-:cached_dcl_mods} & [main_dcl_module_n].dcl_macro_conversions=No}
+ # dcl_modules={{dcl_module \\ dcl_module<-:cached_dcl_mods} & [main_dcl_module_n].dcl_has_macro_conversions=False}
# cache={dcl_modules=dcl_modules,functions_and_macros=cached_functions_and_macros,predef_symbols=unique_copy_of_predef_symbols,hash_table=hash_table,heaps=heaps}
= (success,cache,files)
# cache={dcl_modules=cached_dcl_mods,functions_and_macros=cached_functions_and_macros,predef_symbols=unique_copy_of_predef_symbols,hash_table=hash_table,heaps=heaps}