diff options
author | Adrian Thurston <thurston@complang.org> | 2015-08-08 11:40:19 -0400 |
---|---|---|
committer | Adrian Thurston <thurston@complang.org> | 2015-08-08 11:40:19 -0400 |
commit | 42314c5f0f87c45f6968c7c8fcfbfb8eae9f8ad6 (patch) | |
tree | b5d7d144fe4be7181e3cd4c4292ef9efd6b2805e /src/parsetree.h | |
parent | 835c359b551831b8272dc71e5feaf702aa189576 (diff) | |
download | colm-42314c5f0f87c45f6968c7c8fcfbfb8eae9f8ad6.tar.gz |
moved MethodMap into NameScope, converted some ptrs to objs
Diffstat (limited to 'src/parsetree.h')
-rw-r--r-- | src/parsetree.h | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/src/parsetree.h b/src/parsetree.h index 693260f0..d028b3f7 100644 --- a/src/parsetree.h +++ b/src/parsetree.h @@ -65,6 +65,9 @@ struct TypeAlias; struct RegionSet; struct NameScope; struct IterCall; +struct TemplateType; +struct ObjectMethod; + /* * Code Vector @@ -2315,9 +2318,6 @@ struct ObjectMethod GenericType *generic; }; -typedef AvlMap<String, ObjectMethod*, CmpStr> MethodMap; -typedef AvlMapEl<String, ObjectMethod*> MethodMapEl; - struct RhsVal { RhsVal( ProdEl *prodEl ) @@ -2469,7 +2469,10 @@ typedef DListVal<ObjectField*> FieldList; typedef DList<ObjectField> ParameterList; -struct TemplateType; + +typedef AvlMap<String, ObjectMethod*, CmpStr> MethodMap; +typedef AvlMapEl<String, ObjectMethod*> MethodMapEl; + /* tree_t of name scopes for an object def. All of the object fields inside this * tree live in one object def. This is used for scoping names in functions. */ @@ -2483,7 +2486,8 @@ struct NameScope {} ObjectDef *owner; - FieldMap *fieldMap; + FieldMap fieldMap; + MethodMap methodMap; NameScope *parentScope; DList<NameScope> children; @@ -2505,6 +2509,7 @@ struct NameScope } ObjectField *findField( const String &name ) const; + ObjectMethod *findMethod( const String &name ) const; ObjectField *checkRedecl( const String &name ); void insertField( const String &name, ObjectField *value ); @@ -2536,18 +2541,13 @@ struct ObjectDef o->rootScope = new NameScope; o->rootScope->owner = o; - o->rootScope->fieldMap = new FieldMap; - - o->fieldList = new FieldList; - o->methodMap = new MethodMap; return o; } Type type; String name; - FieldList *fieldList; - MethodMap *methodMap; + FieldList fieldList; NameScope *rootScope; @@ -2560,7 +2560,6 @@ struct ObjectDef void referenceField( Compiler *pd, ObjectField *field ); void placeField( Compiler *pd, ObjectField *field ); void createCode( Compiler *pd, CodeVect &code ); - ObjectMethod *findMethod( const String &name ) const; ObjectField *findFieldInScope( const NameScope *scope, const String &name ) const; ObjectField *checkRedecl( NameScope *inScope, const String &name ); void insertField( NameScope *inScope, const String &name, ObjectField *value ); |