|
@@ -28,7 +28,7 @@
|
|
|
# Let's just agree to disagree on map vs list comprehensions, pylint.
|
|
|
# pylint: disable=I0011,W0141
|
|
|
|
|
|
-import modelverse_jit.source_map as source_map
|
|
|
+import kernel.modelverse_jit.source_map as source_map
|
|
|
|
|
|
PROFILING = False
|
|
|
|
|
@@ -172,7 +172,7 @@ class PythonGenerator(object):
|
|
|
"""Appends the given string to this code generator."""
|
|
|
self.flush_state_definitions()
|
|
|
self.code.append(text)
|
|
|
- for _ in xrange(text.count('\n')):
|
|
|
+ for _ in range(text.count('\n')):
|
|
|
self.source_map_builder.append_line()
|
|
|
|
|
|
def append_indentation(self):
|
|
@@ -396,7 +396,7 @@ class SwitchInstruction(VoidInstruction):
|
|
|
def create(self, new_children):
|
|
|
"""Creates a new instruction of this type from the given sequence of child instructions."""
|
|
|
new_pairs = []
|
|
|
- for i in xrange(len(self.conditions_and_clauses)):
|
|
|
+ for i in range(len(self.conditions_and_clauses)):
|
|
|
new_pairs.append((new_children[2 * i], new_children[2 * i + 1]))
|
|
|
return SwitchInstruction(new_pairs)
|
|
|
|
|
@@ -882,7 +882,7 @@ class DictionaryLiteralInstruction(Instruction):
|
|
|
def create(self, new_children):
|
|
|
"""Creates a new instruction of this type from the given sequence of child instructions."""
|
|
|
new_kv_pairs = []
|
|
|
- for i in xrange(len(self.key_value_pairs)):
|
|
|
+ for i in range(len(self.key_value_pairs)):
|
|
|
new_kv_pairs.append((new_children[2 * i], new_children[2 * i + 1]))
|
|
|
return DictionaryLiteralInstruction(new_kv_pairs)
|
|
|
|
|
@@ -1096,7 +1096,14 @@ class VariableInstruction(Instruction):
|
|
|
"""A base class for instructions that access variables."""
|
|
|
def __init__(self, name):
|
|
|
Instruction.__init__(self)
|
|
|
- if isinstance(name, str) or isinstance(name, unicode) or name is None:
|
|
|
+
|
|
|
+ try:
|
|
|
+ if isinstance(name, unicode):
|
|
|
+ self.name = VariableName(name)
|
|
|
+ except NameError:
|
|
|
+ pass
|
|
|
+
|
|
|
+ if isinstance(name, str) or name is None:
|
|
|
self.name = VariableName(name)
|
|
|
else:
|
|
|
self.name = name
|
|
@@ -1182,7 +1189,13 @@ class TupleStoreLocalInstruction(VoidInstruction):
|
|
|
tuple_lhs = []
|
|
|
tuple_rhs = []
|
|
|
for name, value in self.name_value_pairs:
|
|
|
- if isinstance(name, str) or isinstance(name, unicode) or name is None:
|
|
|
+ try:
|
|
|
+ if isinstance(name, unicode):
|
|
|
+ variable = VariableName(name)
|
|
|
+ except NameError:
|
|
|
+ pass
|
|
|
+
|
|
|
+ if isinstance(name, str) or name is None:
|
|
|
variable = VariableName(name)
|
|
|
else:
|
|
|
variable = name
|