diff options
author | Jeremy Hylton <jeremy@alum.mit.edu> | 2001-08-29 20:56:30 (GMT) |
---|---|---|
committer | Jeremy Hylton <jeremy@alum.mit.edu> | 2001-08-29 20:56:30 (GMT) |
commit | 7845cf8d37f3b1d6cb29cdc9998d1c8b607e251e (patch) | |
tree | e537e98ebb24463416a70f92e2f276ee272d2318 | |
parent | 4ba9001f5c9ecb144d1a63782a3fd5cd3646587a (diff) | |
download | cpython-7845cf8d37f3b1d6cb29cdc9998d1c8b607e251e.zip cpython-7845cf8d37f3b1d6cb29cdc9998d1c8b607e251e.tar.gz cpython-7845cf8d37f3b1d6cb29cdc9998d1c8b607e251e.tar.bz2 |
Make sure that atoms (Tuple, List, etc.) have lineno attributes
-rw-r--r-- | Lib/compiler/transformer.py | 6 | ||||
-rw-r--r-- | Tools/compiler/compiler/transformer.py | 6 |
2 files changed, 8 insertions, 4 deletions
diff --git a/Lib/compiler/transformer.py b/Lib/compiler/transformer.py index 323aa20..6e82b10 100644 --- a/Lib/compiler/transformer.py +++ b/Lib/compiler/transformer.py @@ -99,7 +99,7 @@ class Transformer: def transform(self, tree): """Transform an AST into a modified parse tree.""" if type(tree) != type(()) and type(tree) != type([]): - tree = parser.ast2tuple(tree,1) + tree = parser.ast2tuple(tree, line_info=1) return self.compile_node(tree) def parsesuite(self, text): @@ -657,7 +657,9 @@ class Transformer: return node def atom(self, nodelist): - return self._atom_dispatch[nodelist[0][0]](nodelist) + n = self._atom_dispatch[nodelist[0][0]](nodelist) + n.lineno = nodelist[0][2] + return n def atom_lpar(self, nodelist): if nodelist[1][0] == token.RPAR: diff --git a/Tools/compiler/compiler/transformer.py b/Tools/compiler/compiler/transformer.py index 323aa20..6e82b10 100644 --- a/Tools/compiler/compiler/transformer.py +++ b/Tools/compiler/compiler/transformer.py @@ -99,7 +99,7 @@ class Transformer: def transform(self, tree): """Transform an AST into a modified parse tree.""" if type(tree) != type(()) and type(tree) != type([]): - tree = parser.ast2tuple(tree,1) + tree = parser.ast2tuple(tree, line_info=1) return self.compile_node(tree) def parsesuite(self, text): @@ -657,7 +657,9 @@ class Transformer: return node def atom(self, nodelist): - return self._atom_dispatch[nodelist[0][0]](nodelist) + n = self._atom_dispatch[nodelist[0][0]](nodelist) + n.lineno = nodelist[0][2] + return n def atom_lpar(self, nodelist): if nodelist[1][0] == token.RPAR: |