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 C<T extends core::Object> extends core::Object { | 5 class C<T extends core::Object> extends core::Object { |
6 field dynamic v = new self::Closure#C#v#function::•<self::C::T>(null); | 6 field dynamic v = MakeClosure<(dynamic) → dynamic>(self::closure#C#v#function,
null); |
7 final field dynamic y = new self::Closure#C#y#function::•(null); | 7 final field dynamic y = MakeClosure<() → dynamic>(self::closure#C#y#function,
null); |
8 static final field dynamic z = new self::Closure#C#z#function::•(null); | 8 static final field dynamic z = MakeClosure<() → dynamic>(self::closure#C#z#fun
ction, null); |
9 constructor •() → void | 9 constructor •() → void |
10 : super core::Object::•() | 10 : super core::Object::•() |
11 ; | 11 ; |
12 } | 12 } |
13 class Closure#C#v#function<T extends core::Object> extends core::Object implemen
ts core::Function { | 13 static field dynamic x = MakeClosure<() → dynamic>(self::closure#x#function, nul
l); |
14 field core::String note = "This is temporary. The VM doesn't need closure clas
ses."; | |
15 field Vector context; | |
16 constructor •(final Vector context) → dynamic | |
17 : self::Closure#C#v#function::context = context | |
18 ; | |
19 method call(dynamic x) → dynamic { | |
20 "This is a temporary solution. In the VM, this will become an additional par
ameter."; | |
21 final Vector #contextParameter = this.{self::Closure#C#v#function::context}; | |
22 return x is self::Closure#C#v#function::T; | |
23 } | |
24 } | |
25 class Closure#C#y#function extends core::Object implements core::Function { | |
26 field core::String note = "This is temporary. The VM doesn't need closure clas
ses."; | |
27 field Vector context; | |
28 constructor •(final Vector context) → dynamic | |
29 : self::Closure#C#y#function::context = context | |
30 ; | |
31 method call() → dynamic { | |
32 "This is a temporary solution. In the VM, this will become an additional par
ameter."; | |
33 final Vector #contextParameter = this.{self::Closure#C#y#function::context}; | |
34 return "y"; | |
35 } | |
36 } | |
37 class Closure#C#z#function extends core::Object implements core::Function { | |
38 field core::String note = "This is temporary. The VM doesn't need closure clas
ses."; | |
39 field Vector context; | |
40 constructor •(final Vector context) → dynamic | |
41 : self::Closure#C#z#function::context = context | |
42 ; | |
43 method call() → dynamic { | |
44 "This is a temporary solution. In the VM, this will become an additional par
ameter."; | |
45 final Vector #contextParameter = this.{self::Closure#C#z#function::context}; | |
46 return "z"; | |
47 } | |
48 } | |
49 class Closure#x#function extends core::Object implements core::Function { | |
50 field core::String note = "This is temporary. The VM doesn't need closure clas
ses."; | |
51 field Vector context; | |
52 constructor •(final Vector context) → dynamic | |
53 : self::Closure#x#function::context = context | |
54 ; | |
55 method call() → dynamic { | |
56 "This is a temporary solution. In the VM, this will become an additional par
ameter."; | |
57 final Vector #contextParameter = this.{self::Closure#x#function::context}; | |
58 return "x"; | |
59 } | |
60 } | |
61 static field dynamic x = new self::Closure#x#function::•(null); | |
62 static method main() → dynamic { | 14 static method main() → dynamic { |
63 if(!new self::C::•<core::String>().v("")) | 15 if(!new self::C::•<core::String>().v("")) |
64 throw "C<String>.v false on String"; | 16 throw "C<String>.v false on String"; |
65 if(new self::C::•<core::String>().v(0)) | 17 if(new self::C::•<core::String>().v(0)) |
66 throw "C<String>.v true on int"; | 18 throw "C<String>.v true on int"; |
67 if(new self::C::•<core::String>().v(null)) | 19 if(new self::C::•<core::String>().v(null)) |
68 throw "C<String>.v true on null"; | 20 throw "C<String>.v true on null"; |
69 if(new self::C::•<core::int>().v("")) | 21 if(new self::C::•<core::int>().v("")) |
70 throw "C<int>.v true on String"; | 22 throw "C<int>.v true on String"; |
71 if(!new self::C::•<core::int>().v(0)) | 23 if(!new self::C::•<core::int>().v(0)) |
72 throw "C<int>.v false on int"; | 24 throw "C<int>.v false on int"; |
73 if(new self::C::•<core::int>().v(null)) | 25 if(new self::C::•<core::int>().v(null)) |
74 throw "C<int>.v true on null"; | 26 throw "C<int>.v true on null"; |
75 if(!"x".==(self::x.call())) | 27 if(!"x".==(self::x.call())) |
76 throw "x"; | 28 throw "x"; |
77 if(!"y".==(new self::C::•<core::String>().y())) | 29 if(!"y".==(new self::C::•<core::String>().y())) |
78 throw "y"; | 30 throw "y"; |
79 if(!"z".==(self::C::z.call())) | 31 if(!"z".==(self::C::z.call())) |
80 throw "z"; | 32 throw "z"; |
81 } | 33 } |
| 34 static method closure#C#v#function(Vector #contextParameter, dynamic x) → dynami
c { |
| 35 return x is dynamic; |
| 36 } |
| 37 static method closure#C#y#function(Vector #contextParameter) → dynamic { |
| 38 return "y"; |
| 39 } |
| 40 static method closure#C#z#function(Vector #contextParameter) → dynamic { |
| 41 return "z"; |
| 42 } |
| 43 static method closure#x#function(Vector #contextParameter) → dynamic { |
| 44 return "x"; |
| 45 } |
OLD | NEW |