diff options
author | Adrian Thurston <thurston@complang.org> | 2013-12-31 20:40:49 -0500 |
---|---|---|
committer | Adrian Thurston <thurston@complang.org> | 2013-12-31 20:40:49 -0500 |
commit | b122498fc6058693397744fefc6304766c9d27f2 (patch) | |
tree | b992e0b6e1afba7002f43af16ffd1557ab67c10d /src/lookup.cc | |
parent | f80d0a094e5164cb3c562bed0d8cb14287e0af3e (diff) | |
download | colm-b122498fc6058693397744fefc6304766c9d27f2.tar.gz |
pulling curScope usage out of inner lookup functions
Diffstat (limited to 'src/lookup.cc')
-rw-r--r-- | src/lookup.cc | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/lookup.cc b/src/lookup.cc index bacd097f..73fb7a5d 100644 --- a/src/lookup.cc +++ b/src/lookup.cc @@ -65,15 +65,15 @@ ObjMethod *ObjectDef::findMethod( const String &name ) const return 0; } -VarRefLookup LangVarRef::lookupQualification( Compiler *pd, ObjectDef *rootDef ) const +VarRefLookup LangVarRef::lookupQualification( Compiler *pd, ObjNameScope *rootScope ) const { int lastPtrInQual = -1; - ObjectDef *searchObjDef = rootDef; + ObjNameScope *searchScope = rootScope; int firstConstPart = -1; for ( QualItemVect::Iter qi = *qual; qi.lte(); qi++ ) { /* Lookup the field int the current qualification. */ - ObjectField *el = searchObjDef->curScope->findField( qi->data ); + ObjectField *el = searchScope->findField( qi->data ); if ( el == 0 ) error(qi->loc) << "cannot resolve qualification " << qi->data << endp; @@ -106,10 +106,11 @@ VarRefLookup LangVarRef::lookupQualification( Compiler *pd, ObjectDef *rootDef ) qualUT = pd->findUniqueType( TYPE_TREE, qualUT->langEl ); } - searchObjDef = objDefFromUT( pd, qualUT ); + ObjectDef *searchObjDef = objDefFromUT( pd, qualUT ); + searchScope = searchObjDef->rootScope; } - return VarRefLookup( lastPtrInQual, firstConstPart, searchObjDef ); + return VarRefLookup( lastPtrInQual, firstConstPart, searchScope->owner ); } bool LangVarRef::isLocalRef( Compiler *pd ) const @@ -177,7 +178,7 @@ VarRefLookup LangVarRef::lookupObj( Compiler *pd ) const else rootDef = pd->globalObjectDef; - return lookupQualification( pd, rootDef ); + return lookupQualification( pd, rootDef->curScope ); } VarRefLookup LangVarRef::lookupField( Compiler *pd ) const |