OLD | NEW |
(Empty) | |
| 1 library; |
| 2 import self as self; |
| 3 import "dart:core" as core; |
| 4 import "dart:mock" as mock; |
| 5 |
| 6 class C<T extends core::Object, S extends core::Object> extends core::Object { |
| 7 constructor internal() → void |
| 8 : super core::Object::•() |
| 9 ; |
| 10 method foo(self::C::S s) → dynamic { |
| 11 final mock::Context #context = new mock::Context::•(1); |
| 12 #context.parent = null; |
| 13 #context.[]=(0, this); |
| 14 return new self::Closure#C#foo#function::•<self::C::T, self::C::S>(#context)
; |
| 15 } |
| 16 method bar() → dynamic { |
| 17 self::C<self::C::T, self::C::S> self = this; |
| 18 } |
| 19 method baz() → dynamic { |
| 20 return new self::Closure#C#baz#function::•<self::C::T, self::C::S>(null); |
| 21 } |
| 22 static factory •<T extends core::Object, S extends core::Object>() → self::C<s
elf::C::•::T, self::C::•::S> { |
| 23 final dynamic local = new self::Closure#C#function#local::•<self::C::•::T, s
elf::C::•::S>(null); |
| 24 return local.call(); |
| 25 } |
| 26 } |
| 27 class Closure#C#foo#function<T extends core::Object, S extends core::Object> ext
ends core::Object implements core::Function { |
| 28 field core::String note = "This is temporary. The VM doesn't need closure clas
ses."; |
| 29 field mock::Context context; |
| 30 constructor •(final mock::Context context) → dynamic |
| 31 : self::Closure#C#foo#function::context = context |
| 32 ; |
| 33 method call(self::Closure#C#foo#function::T x) → dynamic { |
| 34 "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}; |
| 36 self::Closure#C#foo#function::T y = x; |
| 37 core::Object z = y; |
| 38 self::C<self::Closure#C#foo#function::T, self::Closure#C#foo#function::S> se
lf = #contextParameter.[](0); |
| 39 return z as self::Closure#C#foo#function::T; |
| 40 } |
| 41 } |
| 42 class Closure#C#baz#function#function<T extends core::Object, S extends core::Ob
ject> extends core::Object implements core::Function { |
| 43 field core::String note = "This is temporary. The VM doesn't need closure clas
ses."; |
| 44 field mock::Context context; |
| 45 constructor •(final mock::Context context) → dynamic |
| 46 : self::Closure#C#baz#function#function::context = context |
| 47 ; |
| 48 method call() → dynamic { |
| 49 "This is a temporary solution. In the VM, this will become an additional par
ameter."; |
| 50 final mock::Context #contextParameter = this.{self::Closure#C#baz#function#f
unction::context}; |
| 51 return self::C::•<self::Closure#C#baz#function#function::T, self::Closure#C#
baz#function#function::S>(); |
| 52 } |
| 53 } |
| 54 class Closure#C#baz#function<T extends core::Object, S extends core::Object> ext
ends core::Object implements core::Function { |
| 55 field core::String note = "This is temporary. The VM doesn't need closure clas
ses."; |
| 56 field mock::Context context; |
| 57 constructor •(final mock::Context context) → dynamic |
| 58 : self::Closure#C#baz#function::context = context |
| 59 ; |
| 60 method call() → dynamic { |
| 61 "This is a temporary solution. In the VM, this will become an additional par
ameter."; |
| 62 final mock::Context #contextParameter = this.{self::Closure#C#baz#function::
context}; |
| 63 return new self::Closure#C#baz#function#function::•<self::Closure#C#baz#func
tion::T, self::Closure#C#baz#function::S>(#contextParameter); |
| 64 } |
| 65 } |
| 66 class Closure#C#function#local<T extends core::Object, S extends core::Object> e
xtends core::Object implements core::Function { |
| 67 field core::String note = "This is temporary. The VM doesn't need closure clas
ses."; |
| 68 field mock::Context context; |
| 69 constructor •(final mock::Context context) → dynamic |
| 70 : self::Closure#C#function#local::context = context |
| 71 ; |
| 72 method call() → dynamic { |
| 73 "This is a temporary solution. In the VM, this will become an additional par
ameter."; |
| 74 final mock::Context #contextParameter = this.{self::Closure#C#function#local
::context}; |
| 75 self::C<self::Closure#C#function#local::T, self::Closure#C#function#local::S
> self = new self::C::internal<self::Closure#C#function#local::T, self::Closure#
C#function#local::S>(); |
| 76 return self; |
| 77 } |
| 78 } |
| 79 static method main(dynamic arguments) → dynamic { |
| 80 core::print(self::C::•<core::String, core::String>().foo(null).call(arguments.
first)); |
| 81 dynamic c = self::C::•<core::int, core::int>().baz().call().call(); |
| 82 if(!(c is self::C<core::int, core::int>)) |
| 83 throw "${c} fails type test 'is C<int, int>'"; |
| 84 if(c is self::C<core::String, core::String>) { |
| 85 throw "${c} passes type test 'is C<String, String>'"; |
| 86 } |
| 87 core::print(c); |
| 88 } |
OLD | NEW |