diff options
author | Claudiu Popa <pcmanticore@gmail.com> | 2018-05-13 15:49:45 -0400 |
---|---|---|
committer | Claudiu Popa <pcmanticore@gmail.com> | 2018-05-13 15:49:45 -0400 |
commit | 517697667497e4df4c7e44d9dba42134ee6f47bc (patch) | |
tree | 9c104b9fbdbd6db417613748161881c8b43f7c74 /astroid/rebuilder.py | |
parent | 812088062e108cf4813e18c81b07d31a6425fc5d (diff) | |
download | astroid-git-517697667497e4df4c7e44d9dba42134ee6f47bc.tar.gz |
Get rid of the astpeephole (it's not an actual peephole and it's optimized just for once single use case
Diffstat (limited to 'astroid/rebuilder.py')
-rw-r--r-- | astroid/rebuilder.py | 19 |
1 files changed, 0 insertions, 19 deletions
diff --git a/astroid/rebuilder.py b/astroid/rebuilder.py index 5d4ffcff..e77c2c28 100644 --- a/astroid/rebuilder.py +++ b/astroid/rebuilder.py @@ -14,7 +14,6 @@ import sys import _ast import astroid -from astroid import astpeephole from astroid import nodes @@ -120,7 +119,6 @@ class TreeRebuilder(object): self._import_from_nodes = [] self._delayed_assattr = [] self._visit_meths = {} - self._peepholer = astpeephole.ASTPeepholeOptimizer() def visit_module(self, node, modname, modpath, package): """visit a Module node by returning a fresh instance of it""" @@ -252,23 +250,6 @@ class TreeRebuilder(object): def visit_binop(self, node, parent): """visit a BinOp node by returning a fresh instance of it""" - if isinstance(node.left, _ast.BinOp) and self._manager.optimize_ast: - # Optimize BinOp operations in order to remove - # redundant recursion. For instance, if the - # following code is parsed in order to obtain - # its ast, then the rebuilder will fail with an - # infinite recursion, the same will happen with the - # inference engine as well. There's no need to hold - # so many objects for the BinOp if they can be reduced - # to something else (also, the optimization - # might handle only Const binops, which isn't a big - # problem for the correctness of the program). - # - # ("a" + "b" + # one thousand more + "c") - optimized = self._peepholer.optimize_binop(node, parent) - if optimized: - return optimized - newnode = nodes.BinOp(_BIN_OP_CLASSES[type(node.op)], node.lineno, node.col_offset, parent) newnode.postinit(self.visit(node.left, newnode), |