diff options
author | Sylvain Thénault <sylvain.thenault@logilab.fr> | 2013-06-18 14:58:26 +0200 |
---|---|---|
committer | Sylvain Thénault <sylvain.thenault@logilab.fr> | 2013-06-18 14:58:26 +0200 |
commit | 2682f50ee379e7e6d7a0c5891ba7211fc8829ab3 (patch) | |
tree | 485dac40fc356da1a6b1da530837738c44e880e8 /rebuilder.py | |
parent | 3d5fd4b0b810c42f0f779afbffffb0bd4df898c6 (diff) | |
download | astroid-git-2682f50ee379e7e6d7a0c5891ba7211fc8829ab3.tar.gz |
[rebuilder] visit_module is a particular visit function (main entry point), move it on top
Diffstat (limited to 'rebuilder.py')
-rw-r--r-- | rebuilder.py | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/rebuilder.py b/rebuilder.py index f777b438..2ce6a19f 100644 --- a/rebuilder.py +++ b/rebuilder.py @@ -127,6 +127,16 @@ class TreeRebuilder(object): self._delayed_assattr = [] self._visit_meths = {} + def visit_module(self, node, modname, package): + """visit a Module node by returning a fresh instance of it""" + newnode = new.Module(modname, None) + newnode.package = package + _lineno_parent(node, newnode, parent=None) + _init_set_doc(node, newnode) + newnode.body = [self.visit(child, newnode) for child in node.body] + newnode.set_line_info(newnode.last_child()) + return newnode + def visit(self, node, parent): cls = node.__class__ if cls in self._visit_meths: @@ -603,16 +613,6 @@ class TreeRebuilder(object): newnode.set_line_info(newnode.last_child()) return newnode - def visit_module(self, node, modname, package): - """visit a Module node by returning a fresh instance of it""" - newnode = new.Module(modname, None) - newnode.package = package - _lineno_parent(node, newnode, parent=None) - _init_set_doc(node, newnode) - newnode.body = [self.visit(child, newnode) for child in node.body] - newnode.set_line_info(newnode.last_child()) - return newnode - def visit_name(self, node, parent): """visit a Name node by returning a fresh instance of it""" # True and False can be assigned to something in py2x, so we have to |