Lines Matching refs:node
125 Some child of the current node had a free reference to name.
217 # node that define new scopes
219 def visitModule(self, node):
220 scope = self.module = self.scopes[node] = ModuleScope()
221 self.visit(node.node, scope)
225 def visitFunction(self, node, parent):
226 if node.decorators:
227 self.visit(node.decorators, parent)
228 parent.add_def(node.name)
229 for n in node.defaults:
231 scope = FunctionScope(node.name, self.module, self.klass)
234 self.scopes[node] = scope
235 self._do_args(scope, node.argnames)
236 self.visit(node.code, scope)
239 def visitGenExpr(self, node, parent):
245 self.scopes[node] = scope
246 self.visit(node.code, scope)
250 def visitGenExprInner(self, node, scope):
251 for genfor in node.quals:
254 self.visit(node.expr, scope)
256 def visitGenExprFor(self, node, scope):
257 self.visit(node.assign, scope, 1)
258 self.visit(node.iter, scope)
259 for if_ in node.ifs:
262 def visitGenExprIf(self, node, scope):
263 self.visit(node.test, scope)
265 def visitLambda(self, node, parent, assign=0):
271 for n in node.defaults:
276 self.scopes[node] = scope
277 self._do_args(scope, node.argnames)
278 self.visit(node.code, scope)
292 def visitClass(self, node, parent):
293 parent.add_def(node.name)
294 for n in node.bases:
296 scope = ClassScope(node.name, self.module)
299 if node.doc is not None:
302 self.scopes[node] = scope
304 self.klass = node.name
305 self.visit(node.code, scope)
315 def visitName(self, node, scope, assign=0):
317 scope.add_def(node.name)
319 scope.add_use(node.name)
323 def visitFor(self, node, scope):
324 self.visit(node.assign, scope, 1)
325 self.visit(node.list, scope)
326 self.visit(node.body, scope)
327 if node.else_:
328 self.visit(node.else_, scope)
330 def visitFrom(self, node, scope):
331 for name, asname in node.names:
336 def visitImport(self, node, scope):
337 for name, asname in node.names:
343 def visitGlobal(self, node, scope):
344 for name in node.names:
347 def visitAssign(self, node, scope):
350 The Assign node doesn't itself contains the variables being
351 assigned to. Instead, the children in node.nodes are visited
360 for n in node.nodes:
362 self.visit(node.expr, scope)
364 def visitAssName(self, node, scope, assign=1):
365 scope.add_def(node.name)
367 def visitAssAttr(self, node, scope, assign=0):
368 self.visit(node.expr, scope, 0)
370 def visitSubscript(self, node, scope, assign=0):
371 self.visit(node.expr, scope, 0)
372 for n in node.subs:
375 def visitSlice(self, node, scope, assign=0):
376 self.visit(node.expr, scope, 0)
377 if node.lower:
378 self.visit(node.lower, scope, 0)
379 if node.upper:
380 self.visit(node.upper, scope, 0)
382 def visitAugAssign(self, node, scope):
385 self.visit(node.node, scope)
386 if isinstance(node.node, ast.Name):
387 self.visit(node.node, scope, 1) # XXX worry about this
388 self.visit(node.expr, scope)
394 def visitIf(self, node, scope):
395 for test, body in node.tests:
402 if node.else_:
403 self.visit(node.else_, scope)
407 def visitYield(self, node, scope):
409 self.visit(node.value, scope)