Commit 0a201a82 authored by John van Groningen's avatar John van Groningen
Browse files

add BENumberedVarTypeNode and BENumberedTypeVar to set tv_argument_nr in type definitions,

add BESetMemberTypeOfField to store the member type of dictionary fields
parent 6bfcede6
......@@ -1420,6 +1420,23 @@ BEVarTypeNode (CleanString name)
return (node);
} /* BEVarTypeNode */
BETypeNodeP
BENumberedVarTypeNode (CleanString name,int argument_n)
{
TypeNode node;
node = ConvertAllocType (struct type_node);
node->type_node_is_var = True;
node->type_node_tv = BENumberedTypeVar (name,argument_n);
node->type_node_arity = 0;
node->type_node_annotation = NoAnnot;
node->type_node_attribute = NoUniAttr;
node->type_for_all_vars = NULL;
return node;
}
BETypeNodeP
BENormalTypeNode (BESymbolP symbol, BETypeArgP args)
{
......@@ -2780,6 +2797,23 @@ BETypeVar (CleanString name)
return (typeVar);
} /* BETypeVar */
BETypeVarP
BENumberedTypeVar (CleanString name,int argument_n)
{
IdentP ident;
TypeVar typeVar;
ident = ConvertAllocType (IdentS);
typeVar = ConvertAllocType (struct type_var);
ident->ident_name = ConvertCleanString (name);
typeVar->tv_ident = ident;
typeVar->tv_argument_nr = argument_n;
return typeVar;
}
BETypeVarListP
BETypeVarListElem (BETypeVarP typeVar, BEAttribution attribute)
{
......@@ -3073,6 +3107,16 @@ BEField (int fieldIndex, int moduleIndex, BETypeNodeP type)
return (field);
} /* BEField */
void
BESetMemberTypeOfField (int fieldIndex, int moduleIndex, BETypeAltP typeAlt)
{
SymbDef sdef;
sdef = gBEState.be_modules [moduleIndex].bem_fields [fieldIndex].symb_def;
sdef->sdef_mark |= SDEF_FIELD_HAS_MEMBER_TYPE;
sdef->sdef_member_type_of_field = typeAlt;
}
BEFieldListP
BEFields (BEFieldListP field, BEFieldListP fields)
{
......
......@@ -217,12 +217,12 @@ Clean (BEConstructorSymbol :: Int Int BackEnd -> (BESymbolP, BackEnd))
BESymbolP BEFieldSymbol (int fieldIndex, int moduleIndex);
Clean (BEFieldSymbol :: Int Int BackEnd -> (BESymbolP, BackEnd))
BESymbolP BETypeSymbolNoMark (int typeIndex, int moduleIndex);
Clean (BETypeSymbolNoMark :: Int Int BackEnd -> (BESymbolP, BackEnd))
BESymbolP BETypeSymbol (int typeIndex, int moduleIndex);
Clean (BETypeSymbol :: Int Int BackEnd -> (BESymbolP, BackEnd))
BESymbolP BETypeSymbolNoMark (int typeIndex, int moduleIndex);
Clean (BETypeSymbolNoMark :: Int Int BackEnd -> (BESymbolP, BackEnd))
BESymbolP BEDontCareDefinitionSymbol (void);
Clean (BEDontCareDefinitionSymbol :: BackEnd -> (BESymbolP, BackEnd))
......@@ -267,6 +267,9 @@ Clean (BEBasicSymbol :: Int BackEnd -> (BESymbolP, BackEnd))
BETypeNodeP BEVarTypeNode (CleanString name);
Clean (BEVarTypeNode :: String BackEnd -> (BETypeNodeP, BackEnd))
BETypeNodeP BENumberedVarTypeNode (CleanString name,int argument_n);
Clean (BENumberedVarTypeNode :: String Int BackEnd -> (BETypeNodeP, BackEnd))
BETypeVarListP BETypeVarListElem (BETypeVarP typeVar, BEAttribution attribute);
Clean (BETypeVarListElem :: BETypeVarP BEAttribution BackEnd -> (BETypeVarListP, BackEnd))
......@@ -466,6 +469,9 @@ Clean (BEDeclareField :: Int Int String BackEnd -> BackEnd)
BEFieldListP BEField (int fieldIndex, int moduleIndex, BETypeNodeP type);
Clean (BEField :: Int Int BETypeNodeP BackEnd -> (BEFieldListP, BackEnd))
void BESetMemberTypeOfField (int fieldIndex, int moduleIndex, BETypeAltP typeAlt);
Clean (BESetMemberTypeOfField :: Int Int BETypeAltP BackEnd -> BackEnd)
BEFieldListP BEFields (BEFieldListP field, BEFieldListP fields);
Clean (BEFields:: BEFieldListP BEFieldListP BackEnd -> (BEFieldListP, BackEnd))
......@@ -478,6 +484,9 @@ Clean (BEDeclareConstructor:: Int Int String BackEnd -> BackEnd)
BETypeVarP BETypeVar (CleanString name);
Clean (BETypeVar:: String BackEnd -> (BETypeVarP, BackEnd))
BETypeVarP BENumberedTypeVar (CleanString name,int argument_n);
Clean (BENumberedTypeVar :: String Int BackEnd -> (BETypeVarP,BackEnd))
void BEDeclareType (int typeIndex, int moduleIndex, CleanString name);
Clean (BEDeclareType:: Int Int String BackEnd -> BackEnd)
......
......@@ -615,6 +615,7 @@ STRUCT (symbol_def,SymbDef){
union {
struct symbol_def * sdef_u2_next_version; /* for IMPRULES */
struct type_alt * sdef_u2_member_type_of_field; /* for FIELDSELECTOR if SDEF_FIELD_HAS_MEMBER_TYPE */
} sdef_u2;
int sdef_mark;
......@@ -648,12 +649,14 @@ STRUCT (symbol_def,SymbDef){
#define SDEF_HAS_IMP_RULE_VERSIONS_MASK 64
#define SDEF_OPTIMISED_FUNCTION_MASK 128
#define SDEF_INLINE_IS_CONSTRUCTOR 4096
#define SDEF_FIELD_HAS_MEMBER_TYPE 16384
/* some macros to reuse bit fields */
#define sdef_group_number sdef_ancestor
#define sdef_next_version sdef_u2.sdef_u2_next_version
#define sdef_member_type_of_field sdef_u2.sdef_u2_member_type_of_field
#define sdef_constructor sdef_typeinfo.typeinfo_constructor
......
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