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