OLD | NEW |
1 library; | 1 library; |
2 import self as self; | 2 import self as self; |
3 import "dart:core" as core; | |
4 | 3 |
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 self::v = #contextParameter[1] = x; | |
15 } | |
16 } | |
17 class Closure#main#function#1 extends core::Object implements core::Function { | |
18 field core::String note = "This is temporary. The VM doesn't need closure clas
ses."; | |
19 field Vector context; | |
20 constructor •(final Vector context) → dynamic | |
21 : self::Closure#main#function#1::context = context | |
22 ; | |
23 method call() → dynamic { | |
24 "This is a temporary solution. In the VM, this will become an additional par
ameter."; | |
25 final Vector #contextParameter = this.{self::Closure#main#function#1::contex
t}; | |
26 for (; #contextParameter[1] = self::v; ) { | |
27 self::v = false; | |
28 } | |
29 } | |
30 } | |
31 static field dynamic v = null; | 4 static field dynamic v = null; |
32 static method main(dynamic arguments) → dynamic { | 5 static method main(dynamic arguments) → dynamic { |
33 final Vector #context = MakeVector(2); | 6 final Vector #context = MakeVector(2); |
34 #context[1] = null; | 7 #context[1] = null; |
35 new self::Closure#main#function::•(#context).call(87); | 8 (MakeClosure<(dynamic) → dynamic>(self::closure#main#function, #context)).call
(87); |
36 if(!self::v.==(87)) { | 9 if(!self::v.==(87)) { |
37 throw "Unexpected value in v: ${self::v}"; | 10 throw "Unexpected value in v: ${self::v}"; |
38 } | 11 } |
39 if(!(#context[1]).==(87)) { | 12 if(!(#context[1]).==(87)) { |
40 throw "Unexpected value in w: ${#context[1]}"; | 13 throw "Unexpected value in w: ${#context[1]}"; |
41 } | 14 } |
42 self::v = true; | 15 self::v = true; |
43 new self::Closure#main#function#1::•(#context).call(); | 16 (MakeClosure<() → dynamic>(self::closure#main#function#1, #context)).call(); |
44 if(!self::v.==(false)) { | 17 if(!self::v.==(false)) { |
45 throw "Unexpected value in v: ${self::v}"; | 18 throw "Unexpected value in v: ${self::v}"; |
46 } | 19 } |
47 if(!(#context[1]).==(false)) { | 20 if(!(#context[1]).==(false)) { |
48 throw "Unexpected value in w: ${#context[1]}"; | 21 throw "Unexpected value in w: ${#context[1]}"; |
49 } | 22 } |
50 } | 23 } |
| 24 static method closure#main#function(Vector #contextParameter, dynamic x) → dynam
ic { |
| 25 return self::v = #contextParameter[1] = x; |
| 26 } |
| 27 static method closure#main#function#1(Vector #contextParameter) → dynamic { |
| 28 for (; #contextParameter[1] = self::v; ) { |
| 29 self::v = false; |
| 30 } |
| 31 } |
OLD | NEW |