feat: implement for-in loop syntax with iterate/iteratorValue protocol and break support

Add `for (variable in sequence)` syntax to the Wren language, introducing the `in` keyword token and compiler support for iterating over sequences using `iterate` and `iteratorValue` methods. Includes new benchmark files for Lua, Python, Ruby, and Wren, plus test cases covering single-expression bodies, block bodies, closures over loop variables, and break statements. Also fixes a missing POP() in CLOSE_UPVALUE and moves the while test file to a subdirectory.
This commit is contained in:
Bob Nystrom
2013-12-25 05:04:11 +00:00
parent c58f15fc87
commit ad559eabd3
18 changed files with 404 additions and 163 deletions
+2
View File
@@ -30,6 +30,8 @@ BENCHMARK("fib", r"""317811
317811
317811""")
BENCHMARK("for", r"""1999999000000""")
BENCHMARK("method_call", r"""true
false""")