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

pass generic info only to instances for OBJECT, CONS and FIELD,

call instance functions for OBJECT, CONS and FIELD directly, with generic info
parent d4bda591
......@@ -1162,38 +1162,16 @@ checkExpression free_vars (PE_Generic id=:{id_name,id_info} kind) e_input e_stat
check_generic_expr free_vars entry=:{ste_kind=STE_Empty} id kind e_input e_state e_info cs=:{cs_error}
= (EE, free_vars, e_state, e_info, { cs & cs_error = checkError id "undefined generic" cs_error })
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 })
= (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
#! (app_args, es_expr_heap, cs)
= case kind of
KindArrow [KindConst]
# (generic_info_expr, es_expr_heap, cs) = build_generic_info es_expr_heap cs
-> ([generic_info_expr], es_expr_heap, cs)
_
-> ([], es_expr_heap, cs)
#! symb_kind = SK_Generic { glob_object = gen_index, glob_module = mod_index} kind
#! 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_args, app_info_ptr = new_info_ptr }
#! 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 }
= (App app, free_vars, e_state, e_info, cs)
where
// adds NoGenericInfo argument to each generic call
build_generic_info es_expr_heap cs=:{cs_predef_symbols}
#! pds_ident = predefined_idents.[PD_NoGenericInfo]
#! ({pds_module, pds_def}, cs_predef_symbols) = cs_predef_symbols ! [PD_NoGenericInfo]
#! (new_info_ptr, es_expr_heap) = newPtr EI_Empty es_expr_heap
#! app =
{ app_symb =
{ symb_ident = pds_ident
, symb_kind = SK_Constructor {glob_module=pds_module, glob_object=pds_def}
}
, app_args = []
, app_info_ptr = new_info_ptr
}
= (App app, es_expr_heap, {cs & cs_predef_symbols = cs_predef_symbols})
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
......
......@@ -44,6 +44,7 @@ where
# initial_info =
{ gen_classes = createArray 32 []
, gen_var_kinds = []
, gen_OBJECT_CONS_FIELD_indices = createArray 3 {ocf_module = -1,ocf_index = -1,ocf_ident={id_name="",id_info=nilPtr}}
}
# (gen_info_ptr, hp_generic_heap) = newPtr initial_info hp_generic_heap
= ( {gen_def & gen_info_ptr = gen_info_ptr},
......
This diff is collapsed.
......@@ -392,7 +392,15 @@ cNameLocationDependent :== True
:: GenericInfo =
{ gen_classes :: !GenericClassInfos
, gen_var_kinds :: ![TypeKind] // kinds of all st_vars of the gen_type
, gen_OBJECT_CONS_FIELD_indices :: !{#OBJECT_CONS_FIELD_index}
}
:: OBJECT_CONS_FIELD_index =
{ ocf_module :: !Int
, ocf_index :: !Int
, ocf_ident :: !Ident
}
:: GenericInfoPtr :== Ptr GenericInfo
:: GenericHeap :== Heap GenericInfo
......@@ -550,7 +558,7 @@ NoGlobalIndex :== {gi_module=NoIndex,gi_index=NoIndex}
| GTSAppBimap TypeKind [GenTypeStruct] // for optimizing bimaps
| GTSPair !GenTypeStruct !GenTypeStruct // for optimizing bimaps
| GTSEither !GenTypeStruct !GenTypeStruct // for optimizing bimaps
:: GenericTypeRep =
{ gtr_type :: GenTypeStruct // generic structure type
, gtr_iso :: !DefinedSymbol // the conversion isomorphism
......
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