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#g 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#g::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#g::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 final (dynamic) → dynamic g = new self::Closure#main#g::•(#context); | 12 final (dynamic) → dynamic g = MakeClosure<(dynamic) → dynamic>(self::closure#m
ain#g, #context); |
25 self::f = g; | 13 self::f = g; |
26 self::foo(); | 14 self::foo(); |
27 } | 15 } |
| 16 static method closure#main#g(Vector #contextParameter, dynamic x) → dynamic { |
| 17 return (#contextParameter[1]).[](x); |
| 18 } |
OLD | NEW |