| OLD | NEW |
| 1 library; | 1 library; |
| 2 import self as self; | 2 import self as self; |
| 3 | 3 |
| 4 static method main() → dynamic { | 4 static method main() → dynamic { |
| 5 dynamic closure; | 5 dynamic closure; |
| 6 { | 6 { |
| 7 Vector #context = MakeVector(2); | 7 Vector #context = MakeVector(3); |
| 8 #context[1] = 0; | 8 #context[2] = 0; |
| 9 dynamic fn = MakeClosure<() → dynamic>(self::closure#main#function, #context
); | 9 dynamic fn = MakeClosure<() → dynamic>(self::closure#main#function, #context
); |
| 10 for (; (#context[1]).<(3); #context = CopyVector(#context), #context[1] = (#
context[1]).+(1)) { | 10 for (; (#context[2]).<(3); #context = CopyVector(#context), #context[2] = (#
context[2]).+(1)) { |
| 11 #context[1] = (#context[1]).+(1); | 11 #context[2] = (#context[2]).+(1); |
| 12 closure = fn; | 12 closure = fn; |
| 13 } | 13 } |
| 14 } | 14 } |
| 15 dynamic x = closure.call(); | 15 dynamic x = closure.call(); |
| 16 if(!x.==(1)) { | 16 if(!x.==(1)) { |
| 17 throw "Expected 1, but got ${x}."; | 17 throw "Expected 1, but got ${x}."; |
| 18 } | 18 } |
| 19 } | 19 } |
| 20 static method closure#main#function(Vector #contextParameter) → dynamic { | 20 static method closure#main#function(Vector #contextParameter) → dynamic { |
| 21 return #contextParameter[1]; | 21 return #contextParameter[2]; |
| 22 } | 22 } |
| OLD | NEW |