Commit 4f596a2c authored by John van Groningen's avatar John van Groningen
Browse files

refactor, move some constructors of type VarInfo and types AuxiliaryPattern,...

refactor, move some constructors of type VarInfo and types AuxiliaryPattern, OptionalVariable, AP_Kind and TypeCodeVariableInfo from module syntax to the module that uses it
parent 1d81babe
......@@ -3951,21 +3951,6 @@ where
NewEntry symbol_table symb_ptr def_kind def_index level previous :==
symbol_table <:= (symb_ptr,{ ste_kind = def_kind, ste_index = def_index, ste_def_level = level, ste_previous = previous })
instance <<< AuxiliaryPattern
where
(<<<) file (AP_Algebraic symbol index patterns var)
= file <<< symbol <<< ' ' <<< patterns
(<<<) file (AP_Variable ident var_ptr var)
= file <<< ident
(<<<) file (AP_Basic val var)
= file <<< val
(<<<) file (AP_Constant kind symbol prio)
= file <<< symbol
(<<<) file (AP_WildCard _)
= file <<< '_'
(<<<) file AP_Empty
= file <<< "<?>"
instance <<< Priority
where
(<<<) file (Prio ass prio) = file <<< "##" <<< prio <<< ass <<< "##"
......
......@@ -15,6 +15,24 @@ cEndWithSelection :== False
cCaseExplicit :== True
cCaseNotExplicit :== False
:: VarInfo
| VI_Record ![AuxiliaryPattern]
| VI_Pattern !AuxiliaryPattern
:: AuxiliaryPattern
= AP_Algebraic !(Global DefinedSymbol) !GlobalIndex ![AuxiliaryPattern] !OptionalVariable
| AP_Variable !Ident !VarInfoPtr OptionalVariable
| AP_Basic !BasicValue OptionalVariable
| AP_NewType !(Global DefinedSymbol) !Index AuxiliaryPattern OptionalVariable
| AP_Dynamic !AuxiliaryPattern !DynamicType !OptionalVariable
| AP_Constant !AP_Kind !(Global DefinedSymbol) !Priority
| AP_WildCard !OptionalVariable
| AP_Empty
:: OptionalVariable :== Optional (Bind Ident VarInfoPtr)
:: AP_Kind = APK_Constructor !GlobalIndex | APK_NewTypeConstructor !Index | APK_Macro !Bool // is_dcl_macro
:: Dynamics :== [ExprInfoPtr]
:: ExpressionState =
......
......@@ -3,6 +3,9 @@ implementation module comparedefimp
from StdFunc import return
import syntax, checksupport, compare_constructor, utilities, compare_types
:: VarInfo
| VI_CorrespondenceNumber !Int
compare_members_of_exported_classes :: !(Optional {#{#Int}}) !Int !Int !*(CommonDefsR b) !*{#DclModule} !*CheckState -> (!*(CommonDefsR b),!*{#DclModule},!*CheckState)
compare_members_of_exported_classes (Yes conversion_table) n_specified_icl_classes n_specified_icl_members icl_common=:{com_class_defs} dcl_modules cs
| n_specified_icl_classes==0
......
......@@ -8,6 +8,15 @@ extended_unify_and_coerce no yes :== no; // change also _unify and _coerce in St
import type_io;
:: VarInfo
| VI_TypeCodeVariable !TypeCodeVariableInfo
| VI_DynamicValueAlias !BoundVar
:: TypeCodeVariableInfo
= TCI_TypeVar !Expression
| TCI_TypePatternVar !Expression
| TCI_SelectionsTypePatternVar ![(Expression,[Selection])]
:: *ConvertDynamicsState =
{ cds_fun_defs :: !*{#FunDef}
, cds_predef_symb :: !*PredefinedSymbols
......
......@@ -788,20 +788,6 @@ pIsSafe :== True
:: ImportedFunctions :== [Global Index]
:: ImportedTypes :== {#{# CheckedTypeDef}}
:: OptionalVariable :== Optional (Bind Ident VarInfoPtr)
:: AuxiliaryPattern
= AP_Algebraic !(Global DefinedSymbol) !GlobalIndex ![AuxiliaryPattern] !OptionalVariable
| AP_Variable !Ident !VarInfoPtr OptionalVariable
| AP_Basic !BasicValue OptionalVariable
| AP_NewType !(Global DefinedSymbol) !Index AuxiliaryPattern OptionalVariable
| AP_Dynamic !AuxiliaryPattern !DynamicType !OptionalVariable
| AP_Constant !AP_Kind !(Global DefinedSymbol) !Priority
| AP_WildCard !OptionalVariable
| AP_Empty
:: AP_Kind = APK_Constructor !GlobalIndex | APK_NewTypeConstructor !Index | APK_Macro !Bool // is_dcl_macro
:: VI_TypeInfo = VITI_Empty
| VITI_Coercion CoercionPosition
| ..
......@@ -809,45 +795,25 @@ pIsSafe :== True
:: VarInfo = VI_Empty | VI_Type !AType !VI_TypeInfo |
VI_FAType ![ATypeVar] !AType !VI_TypeInfo |
VI_FATypeC ![ATypeVar] !AType ![TypeContext] !VI_TypeInfo | VI_FPC |
VI_UsedVar !Ident |
VI_Expression !Expression | VI_Variable !Ident !VarInfoPtr | VI_LiftedVariable !VarInfoPtr |
VI_Expression !Expression | VI_Variable !Ident !VarInfoPtr |
VI_Count !Int /* the reference count of a variable */ !Bool /* true if the variable is global, false otherwise */ |
VI_AccVar !ConsClass !ArgumentPosition /* used during fusion to determine accumulating parameters of functions */ |
VI_Alias !BoundVar /* used for resolving aliases just before type checking (in transform) */ |
/* used during elimination and lifting of cases */
VI_RefFromTupleSel0 !Int |
VI_RefFromArrayUpdate !Int ![Selection] |
VI_RefFromArrayUpdateToTupleSelector2 !Int ![Selection] !VarInfoPtr |
VI_RefFromArrayUpdateOfTupleElem2 !Int ![Selection] |
VI_LocalVar |
VI_ClassVar !Ident !VarInfoPtr !Int | /* to hold dictionary variables during overloading */
VI_EmptyConstructorClassVar |
VI_ForwardClassVar !VarInfoPtr | /* to hold the dictionary variable generated during overloading */
VI_ForwardClassVars !VarInfoPtr !VarInfo |
VI_ForwardTypeContextVar !VarInfoPtr |
VI_Forward !BoundVar |
VI_CorrespondenceNumber !Int | /* it is assumed that this alternative is _only_ used in module comparedefimp */
VI_SequenceNumber !Int | VI_AliasSequenceNumber !BoundVar |
VI_Used | /* for indicating that an imported function has been used */
VI_PropagationType !SymbolType | /* for storing the type with propagation environment of an imported function */
VI_ExpandedType !SymbolType | /* for storing the (expanded) type of an imported function */
VI_ExpandedMemberType !SymbolType !VarInfo /* VI_Empty or VI_ExpandedType */ | // only in sd_type_ptr
VI_Record ![AuxiliaryPattern] |
VI_Pattern !AuxiliaryPattern |
VI_TypeCodeVariable !TypeCodeVariableInfo |
VI_DynamicValueAlias !BoundVar |
VI_Body !SymbIdent !TransformedBody ![FreeVar] ![TypeVar] ![TypeVar] | /* used during fusion */
VI_ExpressionOrBody !Expression !SymbIdent !TransformedBody ![FreeVar] ![TypeVar] ![TypeVar] | /* used during fusion */
VI_Dictionary !SymbIdent ![Expression] !Type | /* used during fusion */
VI_Extended !ExtendedVarInfo !VarInfo |
VI_NotUsed |
..
:: TypeCodeVariableInfo
= TCI_TypeVar !Expression
| TCI_TypePatternVar !Expression
| TCI_SelectionsTypePatternVar ![(Expression,[Selection])]
:: ExtendedVarInfo = EVI_VarType !AType
:: ArgumentPosition :== Int
......
......@@ -26,6 +26,14 @@ SwitchHOFusion fuse dont_fuse :== fuse
SwitchHOFusion` fuse dont_fuse :== fuse
SwitchStrictPossiblyAddLet strict lazy :== lazy//strict
:: VarInfo
| VI_UsedVar !Ident
| VI_Forward !BoundVar
| VI_Body !SymbIdent !TransformedBody ![FreeVar] ![TypeVar] ![TypeVar]
| VI_ExpressionOrBody !Expression !SymbIdent !TransformedBody ![FreeVar] ![TypeVar] ![TypeVar]
| VI_Dictionary !SymbIdent ![Expression] !Type
| VI_NotUsed
/*
(-!->) infix
(-!->) a b :== a // ---> b
......
......@@ -2,6 +2,13 @@ implementation module transform
import syntax, utilities, mergecases
:: VarInfo
| VI_LiftedVariable !VarInfoPtr
| VI_RefFromTupleSel0 !Int
| VI_RefFromArrayUpdate !Int ![Selection]
| VI_RefFromArrayUpdateToTupleSelector2 !Int ![Selection] !VarInfoPtr
| VI_RefFromArrayUpdateOfTupleElem2 !Int ![Selection]
:: LiftState =
{ ls_var_heap :: !.VarHeap
, ls_x :: !.LiftStateX
......
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