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 C extends core::Object { | 5 class C extends core::Object { |
7 field dynamic t; | 6 field dynamic t; |
8 constructor foo(dynamic f) → void | 7 constructor foo(dynamic f) → void |
9 : self::C::t = let final mock::Context #context = new mock::Context::•(1) in
let dynamic #t1 = #context.[]=(0, f) in new self::Closure#C#foo#function::•(#co
ntext), super core::Object::•() { | 8 : self::C::t = let final Vector #context = MakeVector(2) in let dynamic #t1
= #context[1] = f in new self::Closure#C#foo#function::•(#context), super core::
Object::•() { |
10 final mock::Context #context = new mock::Context::•(1); | 9 final Vector #context = MakeVector(2); |
11 #context.[]=(0, f); | 10 #context[1] = f; |
12 core::print(1); | 11 core::print(1); |
13 } | 12 } |
14 } | 13 } |
15 class Closure#C#foo#function extends core::Object implements core::Function { | 14 class Closure#C#foo#function extends core::Object implements core::Function { |
16 field core::String note = "This is temporary. The VM doesn't need closure clas
ses."; | 15 field core::String note = "This is temporary. The VM doesn't need closure clas
ses."; |
17 field mock::Context context; | 16 field Vector context; |
18 constructor •(final mock::Context context) → dynamic | 17 constructor •(final Vector context) → dynamic |
19 : self::Closure#C#foo#function::context = context | 18 : self::Closure#C#foo#function::context = context |
20 ; | 19 ; |
21 method call() → dynamic { | 20 method call() → dynamic { |
22 "This is a temporary solution. In the VM, this will become an additional par
ameter."; | 21 "This is a temporary solution. In the VM, this will become an additional par
ameter."; |
23 final mock::Context #contextParameter = this.{self::Closure#C#foo#function::
context}; | 22 final Vector #contextParameter = this.{self::Closure#C#foo#function::context
}; |
24 return #contextParameter.[](0).call(); | 23 return (#contextParameter[1]).call(); |
25 } | 24 } |
26 } | 25 } |
27 class Closure#main#function extends core::Object implements core::Function { | 26 class Closure#main#function extends core::Object implements core::Function { |
28 field core::String note = "This is temporary. The VM doesn't need closure clas
ses."; | 27 field core::String note = "This is temporary. The VM doesn't need closure clas
ses."; |
29 field mock::Context context; | 28 field Vector context; |
30 constructor •(final mock::Context context) → dynamic | 29 constructor •(final Vector context) → dynamic |
31 : self::Closure#main#function::context = context | 30 : self::Closure#main#function::context = context |
32 ; | 31 ; |
33 method call() → dynamic { | 32 method call() → dynamic { |
34 "This is a temporary solution. In the VM, this will become an additional par
ameter."; | 33 "This is a temporary solution. In the VM, this will become an additional par
ameter."; |
35 final mock::Context #contextParameter = this.{self::Closure#main#function::c
ontext}; | 34 final Vector #contextParameter = this.{self::Closure#main#function::context}
; |
36 return core::print("hest"); | 35 return core::print("hest"); |
37 } | 36 } |
38 } | 37 } |
39 static method main() → dynamic { | 38 static method main() → dynamic { |
40 core::print(0); | 39 core::print(0); |
41 dynamic c = new self::C::foo(new self::Closure#main#function::•(null)); | 40 dynamic c = new self::C::foo(new self::Closure#main#function::•(null)); |
42 core::print(2); | 41 core::print(2); |
43 c.t(); | 42 c.t(); |
44 core::print(3); | 43 core::print(3); |
45 } | 44 } |
OLD | NEW |