because even though it's a bytecode target, it does look captured vars by name, at least that's how Haxe generates it
@@ -472,7 +472,11 @@ let get_config com =
["flash";"errors"],"Error";
["haxe"],"Exception";
];
- }
+ };
+ pf_scoping = {
+ vs_scope = FunctionScope;
+ vs_flags = [VarHoisting];
}
| Php ->
{
@@ -0,0 +1,28 @@
+package unit.issues;
+
+class Issue9624 extends unit.Test {
+ function test() {
+ var result = 0;
+ var index = 0;
+ function f() {
+ while (index < 5) {
+ index = index + 1;
+ var index = index;
+ function capture() {
+ result += index;
+ }
+ // prevent inlining everything
+ capture();
+ f();
+ index = 0;
+ eq(60, result);
+}