diff options
Diffstat (limited to 'frontend/syntax.icl')
-rw-r--r-- | frontend/syntax.icl | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/frontend/syntax.icl b/frontend/syntax.icl index 43bf2a6..28b9649 100644 --- a/frontend/syntax.icl +++ b/frontend/syntax.icl @@ -844,13 +844,22 @@ cNotVarNumber :== -1 } :: TypeContext = - { tc_class :: !Global DefinedSymbol + { tc_class :: !TCClass , tc_types :: ![Type] , tc_var :: !VarInfoPtr } -:: TCClass = TCClass !(Global DefinedSymbol) - | TCGeneric !(Global DefinedSymbol) !TypeKind +//AA: class in a type context is either normal class or a generic class +:: TCClass = TCClass !(Global DefinedSymbol) // Normal class + | TCGeneric !GenericTypeContext // Generic class + +:: GenericTypeContext = + { gtc_generic :: !(Global DefinedSymbol) + , gtc_kind :: !TypeKind + , gtc_class :: !(Global DefinedSymbol) // generated class + , gtc_dictionary:: !(Global DefinedSymbol) // HACK: dictionary different from the one contained in the class + } +//..AA :: AType = { at_attribute :: !TypeAttribute @@ -1544,6 +1553,16 @@ instance <<< TypeContext where (<<<) file co = file <<< co.tc_class <<< " " <<< co.tc_types <<< " <" <<< co.tc_var <<< '>' +instance <<< TCClass +where + (<<<) file (TCClass glob) = file <<< glob + (<<<) file (TCGeneric {gtc_generic,gtc_kind}) = file <<< gtc_generic <<< gtc_kind + +instance toString TCClass +where + toString (TCClass clazz) = clazz.glob_object.ds_ident.id_name + toString (TCGeneric {gtc_generic,gtc_kind}) = gtc_generic.glob_object.ds_ident.id_name +++ toString gtc_kind + instance <<< SymbIdent where (<<<) file symb=:{symb_kind = SK_Function symb_index } |