summaryrefslogtreecommitdiff
path: root/src/lookup.cc
diff options
context:
space:
mode:
authorAdrian Thurston <thurston@complang.org>2014-01-01 12:18:16 -0500
committerAdrian Thurston <thurston@complang.org>2014-01-01 12:18:16 -0500
commit3df7d5d7711b2f74ec1057872b96ec35131d6a8b (patch)
tree07df84ecd8908edc052087b51d572c7bd8612a89 /src/lookup.cc
parente5c35b096fb622b203d6a92144ec1e7443655e0c (diff)
downloadcolm-3df7d5d7711b2f74ec1057872b96ec35131d6a8b.tar.gz
store current context in var ref
This eliminates for lookup to happen during walk with context maintained in Compiler.
Diffstat (limited to 'src/lookup.cc')
-rw-r--r--src/lookup.cc10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/lookup.cc b/src/lookup.cc
index 3b8986bc..57ab56c3 100644
--- a/src/lookup.cc
+++ b/src/lookup.cc
@@ -129,14 +129,14 @@ bool LangVarRef::isLocalRef( Compiler *pd ) const
bool LangVarRef::isContextRef( Compiler *pd ) const
{
- if ( pd->context != 0 ) {
+ if ( context != 0 ) {
if ( qual->length() > 0 ) {
- if ( pd->context->contextObjDef->rootScope->findField( qual->data[0].data ) != 0 )
+ if ( context->contextObjDef->rootScope->findField( qual->data[0].data ) != 0 )
return true;
}
- else if ( pd->context->contextObjDef->rootScope->findField( name ) != 0 )
+ else if ( context->contextObjDef->rootScope->findField( name ) != 0 )
return true;
- else if ( pd->context->contextObjDef->findMethod( name ) != 0 )
+ else if ( context->contextObjDef->findMethod( name ) != 0 )
return true;
}
@@ -172,7 +172,7 @@ VarRefLookup LangVarRef::lookupObj( Compiler *pd ) const
if ( isLocalRef( pd ) )
rootScope = scope;
else if ( isContextRef( pd ) )
- rootScope = pd->context->contextObjDef->rootScope;
+ rootScope = context->contextObjDef->rootScope;
else
rootScope = pd->globalObjectDef->rootScope;