| OLD | NEW |
| 1 library; | 1 library; |
| 2 import self as self; | 2 import self as self; |
| 3 import "dart:core" as core; | 3 import "dart:core" as core; |
| 4 import "dart:mock" as mock; | |
| 5 | 4 |
| 6 class Closure#main#function extends core::Object implements core::Function { | 5 class Closure#main#function extends core::Object implements core::Function { |
| 7 field core::String note = "This is temporary. The VM doesn't need closure clas
ses."; | 6 field core::String note = "This is temporary. The VM doesn't need closure clas
ses."; |
| 8 field mock::Context context; | 7 field Vector context; |
| 9 constructor •(final mock::Context context) → dynamic | 8 constructor •(final Vector context) → dynamic |
| 10 : self::Closure#main#function::context = context | 9 : self::Closure#main#function::context = context |
| 11 ; | 10 ; |
| 12 method call() → dynamic { | 11 method call() → dynamic { |
| 13 "This is a temporary solution. In the VM, this will become an additional par
ameter."; | 12 "This is a temporary solution. In the VM, this will become an additional par
ameter."; |
| 14 final mock::Context #contextParameter = this.{self::Closure#main#function::c
ontext}; | 13 final Vector #contextParameter = this.{self::Closure#main#function::context}
; |
| 15 return #contextParameter.[](0); | 14 return #contextParameter[1]; |
| 16 } | 15 } |
| 17 } | 16 } |
| 18 static method main() → dynamic { | 17 static method main() → dynamic { |
| 19 dynamic closure; | 18 dynamic closure; |
| 20 { | 19 { |
| 21 mock::Context #context = new mock::Context::•(1); | 20 Vector #context = MakeVector(2); |
| 22 #context.[]=(0, 0); | 21 #context[1] = 0; |
| 23 dynamic fn = new self::Closure#main#function::•(#context); | 22 dynamic fn = new self::Closure#main#function::•(#context); |
| 24 for (; #context.[](0).<(3); #context = #context.copy(), #context.[]=(0, #con
text.[](0).+(1))) { | 23 for (; (#context[1]).<(3); #context = CopyVector(#context), #context[1] =(#c
ontext[1]).+(1)) { |
| 25 #context.[]=(0, #context.[](0).+(1)); | 24 #context[1] =(#context[1]).+(1); |
| 26 closure = fn; | 25 closure = fn; |
| 27 } | 26 } |
| 28 } | 27 } |
| 29 dynamic x = closure.call(); | 28 dynamic x = closure.call(); |
| 30 if(!x.==(1)) { | 29 if(!x.==(1)) { |
| 31 throw "Expected 1, but got ${x}."; | 30 throw "Expected 1, but got ${x}."; |
| 32 } | 31 } |
| 33 } | 32 } |
| OLD | NEW |