Revision: 10489
Author:   [email protected]
Date:     Tue Jan 24 06:29:02 2012
Log:      Fix JS2C, so that macros with multiple parameters actually WORK.

[email protected]
BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com/9146035
http://code.google.com/p/v8/source/detail?r=10489

Modified:
 /branches/bleeding_edge/tools/js2c.py

=======================================
--- /branches/bleeding_edge/tools/js2c.py       Mon Jun  6 13:47:30 2011
+++ /branches/bleeding_edge/tools/js2c.py       Tue Jan 24 06:29:02 2012
@@ -128,12 +128,13 @@
       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:

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to