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