A more correct offset2inst_index update.

This commit is contained in:
rocky
2020-02-01 21:02:45 -05:00
parent 16a51961c3
commit de1e7d423c

View File

@@ -260,7 +260,8 @@ class SourceWalker(GenericASTTraversal, object):
self.ast_errors = []
# FIXME: have p.insts update in a better way
# modularity is broken here
self.p.insts = scanner.insts
self.insts = scanner.insts
self.offset2inst_index = scanner.offset2inst_index
# This is in Python 2.6 on. It changes the way
# strings get interpreted. See n_LOAD_CONST
@@ -2407,9 +2408,11 @@ class SourceWalker(GenericASTTraversal, object):
# modularity is broken here
p_insts = self.p.insts
self.p.insts = self.scanner.insts
self.p.offset2inst_index = self.scanner.offset2inst_index
ast = python_parser.parse(self.p, tokens, customize)
self.customize(customize)
self.p.insts = p_insts
except (python_parser.ParserError, AssertionError) as e:
raise ParserError(e, tokens)
transform_ast = self.treeTransform.transform(ast)
@@ -2442,8 +2445,8 @@ class SourceWalker(GenericASTTraversal, object):
# modularity is broken here
p_insts = self.p.insts
self.p.insts = self.scanner.insts
self.p.opc = self.scanner.opc
self.p.offset2inst_index = self.scanner.offset2inst_index
self.p.opc = self.scanner.opc
ast = python_parser.parse(self.p, tokens, customize)
self.p.insts = p_insts
except (python_parser.ParserError, AssertionError) as e: