@@ -131,27 +131,23 @@ def visit_subexpression(self, node, value):
131
131
return result
132
132
133
133
def visit_field (self , node , value , * args , ** kwargs ):
134
-
135
134
identifier = node ['value' ]
136
-
137
- ## inner function to retrieve the given
138
- ## value from the scopes stack
139
-
140
- def get_value_from_current_context_or_scopes ():
141
- if 'scopes' in kwargs :
142
- return kwargs ['scopes' ].getValue (identifier )
143
- return None
144
-
145
- ## search for identifier value
135
+ scopes = kwargs .get ('scopes' )
146
136
147
137
try :
148
138
result = value .get (identifier )
149
139
if result == None :
150
- result = get_value_from_current_context_or_scopes ()
140
+ result = self ._get_from_scopes (
141
+ identifier , * args , scopes = scopes )
151
142
return result
152
143
except AttributeError :
153
- return get_value_from_current_context_or_scopes ()
144
+ return self ._get_from_scopes (
145
+ identifier , * args , scopes = scopes )
154
146
147
+ def _get_from_scopes (self , identifier , * args , ** kwargs ):
148
+ if 'scopes' in kwargs :
149
+ return kwargs ['scopes' ].getValue (identifier )
150
+ return None
155
151
156
152
def visit_comparator (self , node , value ):
157
153
# Common case: comparator is == or !=
0 commit comments