| library; |
| import self as self; |
| import "dart:core" as core; |
| |
| class C extends core::Object { |
| field dynamic f = MakeClosure<() → dynamic>(self::closure#C#f#function, null); |
| default constructor •() → void |
| : super core::Object::•() |
| ; |
| get g() → dynamic |
| return MakeClosure<(dynamic) → dynamic>(self::closure#C#g#function, null); |
| method a() → dynamic |
| return "a"; |
| method b(dynamic x) → dynamic |
| return x; |
| method c(dynamic x, [dynamic y = 2]) → dynamic |
| return x.+(y); |
| method d(dynamic x, {dynamic y = 2}) → dynamic |
| return x.+(y); |
| } |
| class D<T extends core::Object> extends core::Object { |
| field dynamic f = MakeClosure<() → dynamic>(self::closure#D#f#function, null); |
| default constructor •() → void |
| : super core::Object::•() |
| ; |
| get g() → dynamic |
| return MakeClosure<(dynamic) → dynamic>(self::closure#D#g#function, null); |
| method a() → dynamic |
| return "a"; |
| method b(dynamic x) → dynamic |
| return x; |
| method c(dynamic x, [dynamic y = 2]) → dynamic |
| return x.+(y); |
| method d(dynamic x, {dynamic y = 2}) → dynamic |
| return x.+(y); |
| } |
| class E<T extends core::Object> extends core::Object { |
| field dynamic f = MakeClosure<() → dynamic>(self::closure#E#f#function, null); |
| default constructor •() → void |
| : super core::Object::•() |
| ; |
| get g() → dynamic |
| return MakeClosure<<T extends core::Object>(T) → dynamic, self::E::T>(self::closure#E#g#function, MakeVector(1)); |
| method a() → dynamic |
| return "a"; |
| method b(self::E::T x) → dynamic |
| return x; |
| method c(self::E::T x, [self::E::T y = 2]) → dynamic |
| return x.+(y); |
| method d(self::E::T x, {self::E::T y = 2}) → dynamic |
| return x.+(y); |
| } |
| static method expect(dynamic expected, dynamic actual) → dynamic { |
| core::print("Expecting '${expected}' and got '${actual}'"); |
| if(!expected.==(actual)) { |
| core::print("Expected '${expected}' but got '${actual}'"); |
| throw "Expected '${expected}' but got '${actual}'"; |
| } |
| } |
| static method test(dynamic o) → dynamic { |
| self::expect("f", o.f()); |
| self::expect("f", o.f.call()); |
| self::expect("g(42)", o.g(42)); |
| self::expect("g(42)", o.g.call(42)); |
| self::expect("a", o.a()); |
| self::expect("a", o.a.call()); |
| self::expect(42, o.b(42)); |
| self::expect(42, o.b.call(42)); |
| self::expect(42, o.c(40)); |
| self::expect(42, o.c.call(40)); |
| self::expect(87, o.c(80, 7)); |
| self::expect(87, o.c.call(80, 7)); |
| self::expect(42, o.d(40)); |
| self::expect(42, o.d.call(40)); |
| self::expect(87, o.d(80, y: 7)); |
| self::expect(87, o.d.call(80, y: 7)); |
| } |
| static method main(dynamic arguments) → dynamic { |
| self::test(new self::C::•()); |
| self::test(new self::D::•<core::int>()); |
| self::test(new self::E::•<core::int>()); |
| } |
| static method closure#C#g#function(Vector #contextParameter, dynamic x) → dynamic { |
| return "g(${x})"; |
| } |
| static method closure#C#f#function(Vector #contextParameter) → dynamic { |
| return "f"; |
| } |
| static method closure#D#g#function(Vector #contextParameter, dynamic x) → dynamic { |
| return "g(${x})"; |
| } |
| static method closure#D#f#function(Vector #contextParameter) → dynamic { |
| return "f"; |
| } |
| static method closure#E#g#function<T extends core::Object>(Vector #contextParameter, self::closure#E#g#function::T x) → dynamic { |
| return "g(${x})"; |
| } |
| static method closure#E#f#function(Vector #contextParameter) → dynamic { |
| return "f"; |
| } |