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#function extends core::Object implements core::Func
tion { | 14 class Closure#C#foo#function#function extends core::Object implements core::Func
tion { |
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#function::context = context | 18 : self::Closure#C#foo#function#function::context = context |
20 ; | 19 ; |
21 method call(dynamic x) → dynamic { | 20 method call(dynamic x) → 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#f
unction::context}; | 22 final Vector #contextParameter = this.{self::Closure#C#foo#function#function
::context}; |
24 #contextParameter.parent.[](0).call("${#contextParameter.[](0)}${x}"); | 23 (#contextParameter[0][1]).call("${#contextParameter[1]}${x}"); |
25 } | 24 } |
26 } | 25 } |
27 class Closure#C#foo#function extends core::Object implements core::Function { | 26 class Closure#C#foo#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#C#foo#function::context = context | 30 : self::Closure#C#foo#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#C#foo#function::
context}; | 34 final Vector #contextParameter = this.{self::Closure#C#foo#function::context
}; |
36 final mock::Context #context = new mock::Context::•(1); | 35 final Vector #context = MakeVector(2); |
37 #context.parent = #contextParameter; | 36 #context[0] = #contextParameter; |
38 #context.[]=(0, null); | 37 #context[1] = null; |
39 dynamic g = new self::Closure#C#foo#function#function::•(#context); | 38 dynamic g = new self::Closure#C#foo#function#function::•(#context); |
40 #context.[]=(0, "hest"); | 39 #context[1] = "hest"; |
41 return g; | 40 return g; |
42 } | 41 } |
43 } | 42 } |
44 class Closure#main#function extends core::Object implements core::Function { | 43 class Closure#main#function extends core::Object implements core::Function { |
45 field core::String note = "This is temporary. The VM doesn't need closure clas
ses."; | 44 field core::String note = "This is temporary. The VM doesn't need closure clas
ses."; |
46 field mock::Context context; | 45 field Vector context; |
47 constructor •(final mock::Context context) → dynamic | 46 constructor •(final Vector context) → dynamic |
48 : self::Closure#main#function::context = context | 47 : self::Closure#main#function::context = context |
49 ; | 48 ; |
50 method call(dynamic x) → dynamic { | 49 method call(dynamic x) → dynamic { |
51 "This is a temporary solution. In the VM, this will become an additional par
ameter."; | 50 "This is a temporary solution. In the VM, this will become an additional par
ameter."; |
52 final mock::Context #contextParameter = this.{self::Closure#main#function::c
ontext}; | 51 final Vector #contextParameter = this.{self::Closure#main#function::context}
; |
53 return core::print(x); | 52 return core::print(x); |
54 } | 53 } |
55 } | 54 } |
56 static method main() → dynamic { | 55 static method main() → dynamic { |
57 core::print(0); | 56 core::print(0); |
58 dynamic c = new self::C::foo(new self::Closure#main#function::•(null)); | 57 dynamic c = new self::C::foo(new self::Closure#main#function::•(null)); |
59 core::print(2); | 58 core::print(2); |
60 c.t().call("fisk"); | 59 c.t().call("fisk"); |
61 core::print(3); | 60 core::print(3); |
62 } | 61 } |
OLD | NEW |