| 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 | 4 |
| 5 class Closure#main#function extends core::Object implements core::Function { | |
| 6 field core::String note = "This is temporary. The VM doesn't need closure clas
ses."; | |
| 7 field Vector context; | |
| 8 constructor •(final Vector context) → dynamic | |
| 9 : self::Closure#main#function::context = context | |
| 10 ; | |
| 11 method call(dynamic x) → dynamic { | |
| 12 "This is a temporary solution. In the VM, this will become an additional par
ameter."; | |
| 13 final Vector #contextParameter = this.{self::Closure#main#function::context}
; | |
| 14 return (#contextParameter[1]).[](x); | |
| 15 } | |
| 16 } | |
| 17 static field dynamic f = null; | 5 static field dynamic f = null; |
| 18 static method foo() → dynamic { | 6 static method foo() → dynamic { |
| 19 core::print(self::f.call(0)); | 7 core::print(self::f.call(0)); |
| 20 } | 8 } |
| 21 static method main(dynamic arguments) → dynamic { | 9 static method main(dynamic arguments) → dynamic { |
| 22 final Vector #context = MakeVector(2); | 10 final Vector #context = MakeVector(2); |
| 23 #context[1] = arguments; | 11 #context[1] = arguments; |
| 24 self::f = new self::Closure#main#function::•(#context); | 12 self::f = MakeClosure<(dynamic) → dynamic>(closure#main#function, #context); |
| 25 self::foo(); | 13 self::foo(); |
| 26 } | 14 } |
| 15 static method closure#main#function(Vector #contextParameter, dynamic x) → dynam
ic { |
| 16 return (#contextParameter[1]).[](x); |
| 17 } |
| OLD | NEW |