summaryrefslogtreecommitdiff
path: root/deps/v8/tools/js2c.py
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/tools/js2c.py')
-rw-r--r--deps/v8/tools/js2c.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/deps/v8/tools/js2c.py b/deps/v8/tools/js2c.py
index a2ea8eacc7..fa559f362c 100644
--- a/deps/v8/tools/js2c.py
+++ b/deps/v8/tools/js2c.py
@@ -128,12 +128,13 @@ def ExpandMacros(lines, macros):
end = pattern_match.end()
assert lines[end - 1] == '('
last_match = end
- arg_index = 0
+ arg_index = [0] # Wrap state into array, to work around Python "scoping"
mapping = { }
def add_arg(str):
# Remember to expand recursively in the arguments
replacement = ExpandMacros(str.strip(), macros)
- mapping[macro.args[arg_index]] = replacement
+ mapping[macro.args[arg_index[0]]] = replacement
+ arg_index[0] += 1
while end < len(lines) and height > 0:
# We don't count commas at higher nesting levels.
if lines[end] == ',' and height == 1: