diff options
author | Adrian Thurston <thurston@complang.org> | 2011-06-21 05:41:32 +0000 |
---|---|---|
committer | Adrian Thurston <thurston@complang.org> | 2011-06-21 05:41:32 +0000 |
commit | e40e3c56f6f7d457bdf1f00b4ff87d27664f59c6 (patch) | |
tree | f54d8835ec1675b150dd47a84035a32cad97799c | |
parent | bca7c71b5f3557053e953449c7e10b060a6b9826 (diff) | |
download | colm-e40e3c56f6f7d457bdf1f00b4ff87d27664f59c6.tar.gz |
Removed the call to lookupType from construct compile, added it to the resolve
pass. refs #298.
-rw-r--r-- | colm/compile.cc | 2 | ||||
-rw-r--r-- | colm/resolve.cc | 20 |
2 files changed, 20 insertions, 2 deletions
diff --git a/colm/compile.cc b/colm/compile.cc index 0e504094..e5813b80 100644 --- a/colm/compile.cc +++ b/colm/compile.cc @@ -1199,7 +1199,7 @@ UniqueType *LangTerm::evaluateConstruct( ParseData *pd, CodeVect &code ) const /* Lookup the type of the replacement and store it in the replacement * object so that replacement parsing has a target. */ - UniqueType *replUT = typeRef->lookupType( pd ); + UniqueType *replUT = typeRef->uniqueType; if ( replUT->typeId == TYPE_TREE ) replacement->langEl = replUT->langEl; else diff --git a/colm/resolve.cc b/colm/resolve.cc index 1aac05f1..ec87853a 100644 --- a/colm/resolve.cc +++ b/colm/resolve.cc @@ -120,17 +120,32 @@ void TypeRef::resolve( ParseData *pd ) const void LangTerm::resolve( ParseData *pd ) const { - /* FIXME: implementation missing here. */ switch ( type ) { case ConstructType: typeRef->resolve( pd ); + typeRef->lookupType( pd ); + + /* Evaluate the initialization expressions. */ + if ( fieldInitArgs != 0 ) { + for ( FieldInitVect::Iter pi = *fieldInitArgs; pi.lte(); pi++ ) + (*pi)->expr->resolve( pd ); + } break; case VarRefType: + break; case MethodCallType: + if ( args != 0 ) { + for ( ExprVect::Iter pe = *args; pe.lte(); pe++ ) + (*pe)->resolve( pd ); + } + break; case NumberType: case StringType: case MatchType: + break; case NewType: + expr->resolve( pd ); + break; case TypeIdType: case SearchType: case NilType: @@ -223,6 +238,8 @@ void LangStmt::resolve( ParseData *pd ) const break; } case ElseType: { + for ( StmtList::Iter stmt = *stmtList; stmt.lte(); stmt++ ) + stmt->resolve( pd ); break; } case RejectType: @@ -237,6 +254,7 @@ void LangStmt::resolve( ParseData *pd ) const } case AssignType: { /* Evaluate the exrepssion. */ +// cout << "Assign Type" << endl; expr->resolve( pd ); break; } |