OLD | NEW |
(Empty) | |
| 1 library generic_methods_dynamic_test; |
| 2 import self as self; |
| 3 import "dart:core" as core; |
| 4 import "../../runtime/reify/interceptors.dart" as int; |
| 5 import "../../runtime/reify/types.dart" as typ; |
| 6 import "./test_base.dart" as tes; |
| 7 import "../../runtime/reify/declarations.dart" as dec; |
| 8 |
| 9 class A extends core::Object implements int::HasRuntimeTypeGetter { |
| 10 constructor •() → void |
| 11 : super core::Object::•() |
| 12 ; |
| 13 get $type() → typ::ReifiedType |
| 14 return new typ::Interface::•(self::$declarations.[](0)); |
| 15 get $is$List() → core::bool |
| 16 return false; |
| 17 } |
| 18 class B extends core::Object implements int::HasRuntimeTypeGetter { |
| 19 constructor •() → void |
| 20 : super core::Object::•() |
| 21 ; |
| 22 get $type() → typ::ReifiedType |
| 23 return new typ::Interface::•(self::$declarations.[](1)); |
| 24 get $is$List() → core::bool |
| 25 return false; |
| 26 } |
| 27 class C extends core::Object implements int::HasRuntimeTypeGetter { |
| 28 constructor •() → void |
| 29 : super core::Object::•() |
| 30 ; |
| 31 method foo<T extends core::Object>(dynamic t, {core::List<typ::ReifiedType> $t
ypeParameters}) → dynamic { |
| 32 return t; |
| 33 } |
| 34 method bar<T extends core::Object>(core::Iterable<self::C::bar::T> t, {core::L
ist<typ::ReifiedType> $typeParameters}) → core::List<self::C::bar::T> { |
| 35 return int::attachType(<dynamic>[t.{core::Iterable::first}], new typ::Interf
ace::•(self::$declarations.[](3), <dynamic>[this.$C$T])); |
| 36 } |
| 37 get $type() → typ::ReifiedType |
| 38 return new typ::Interface::•(self::$declarations.[](2)); |
| 39 get $is$List() → core::bool |
| 40 return false; |
| 41 } |
| 42 static final field core::List<dec::Class> $declarations = (core::List<dec::Class
> d) → core::List<dec::Class> { |
| 43 dec::init(d, 0, new typ::Interface::•(d.[](17))); |
| 44 dec::init(d, 1, new typ::Interface::•(d.[](17))); |
| 45 dec::init(d, 2, new typ::Interface::•(d.[](17))); |
| 46 dec::init(d, 3, new typ::Interface::•(d.[](17)), <dynamic>[new typ::Interface:
:•(d.[](19), <dynamic>[d.[](3).variables.[](0)])]); |
| 47 dec::init(d, 4, new typ::Interface::•(d.[](17))); |
| 48 dec::init(d, 5, new typ::Interface::•(d.[](17))); |
| 49 dec::init(d, 6, new typ::Interface::•(d.[](17)), <dynamic>[new typ::Interface:
:•(d.[](20), <dynamic>[new typ::Interface::•(d.[](6))]), new typ::Interface::•(d
.[](21))]); |
| 50 dec::init(d, 7, new typ::Interface::•(d.[](22))); |
| 51 dec::init(d, 8, new typ::Interface::•(d.[](22))); |
| 52 dec::init(d, 9, new typ::Interface::•(d.[](17))); |
| 53 dec::init(d, 10, new typ::Interface::•(d.[](23))); |
| 54 dec::init(d, 11, new typ::Interface::•(d.[](23))); |
| 55 dec::init(d, 12, new typ::Interface::•(d.[](23))); |
| 56 dec::init(d, 13, new typ::Interface::•(d.[](23))); |
| 57 dec::init(d, 14, new typ::Interface::•(d.[](17)), <dynamic>[new typ::Interface
::•(d.[](24))]); |
| 58 dec::init(d, 15, new typ::Interface::•(d.[](16))); |
| 59 dec::init(d, 16, new typ::Interface::•(d.[](23))); |
| 60 dec::init(d, 17, null); |
| 61 dec::init(d, 19, new typ::Interface::•(d.[](25), <dynamic>[d.[](19).variables.
[](0)])); |
| 62 dec::init(d, 20, new typ::Interface::•(d.[](17))); |
| 63 dec::init(d, 21, new typ::Interface::•(d.[](17))); |
| 64 dec::init(d, 22, new typ::Interface::•(d.[](17)), <dynamic>[new typ::Interface
::•(d.[](20), <dynamic>[new typ::Interface::•(d.[](22))])]); |
| 65 dec::init(d, 23, new typ::Interface::•(d.[](17))); |
| 66 dec::init(d, 24, new typ::Interface::•(d.[](17))); |
| 67 dec::init(d, 25, new typ::Interface::•(d.[](17))); |
| 68 return d; |
| 69 }.call(dec::allocateDeclarations(<dynamic>["A", "B", "C", "List", "Null", "bool"
, "String", "int", "double", "Type", "AbstractClassInstantiationError", "NoSuchM
ethodError", "CyclicInitializationError", "UnsupportedError", "IntegerDivisionBy
ZeroException", "RangeError", "ArgumentError", "Object", "HasRuntimeTypeGetter",
"EfficientLengthIterable", "Comparable", "Pattern", "num", "Error", "Exception"
, "Iterable"], <dynamic>[0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
, 1, 1, 0, 0, 0, 0, 1])); |
| 70 static method main() → dynamic { |
| 71 self::B b = new self::B::•(); |
| 72 self::C c = new self::C::•(); |
| 73 dynamic obj = c; |
| 74 tes::expectTrue(c.{self::C::foo}(b, $typeParameters: <typ::ReifiedType>[new ty
p::Interface::•(self::$declarations.[](1))]).{core::Object::==}(b)); |
| 75 tes::expectTrue(obj.foo(b, $typeParameters: <typ::ReifiedType>[new typ::Interf
ace::•(self::$declarations.[](1))]).==(b)); |
| 76 dynamic x = c.{self::C::bar}(int::attachType(<self::B>[new self::B::•()], new
typ::Interface::•(self::$declarations.[](3), <dynamic>[new typ::Interface::•(sel
f::$declarations.[](1))])), $typeParameters: <typ::ReifiedType>[new typ::Interfa
ce::•(self::$declarations.[](1))]); |
| 77 tes::expectTrue(typ::isSubtypeOf(int::type(x), new typ::Interface::•(self::$de
clarations.[](3), <dynamic>[new typ::Interface::•(self::$declarations.[](1))])))
; |
| 78 tes::expectTrue(x.length.==(1)); |
| 79 dynamic y = obj.bar(int::attachType(<self::B>[new self::B::•()], new typ::Inte
rface::•(self::$declarations.[](3), <dynamic>[new typ::Interface::•(self::$decla
rations.[](1))])), $typeParameters: <typ::ReifiedType>[new typ::Interface::•(sel
f::$declarations.[](1))]); |
| 80 tes::expectTrue(typ::isSubtypeOf(int::type(y), new typ::Interface::•(self::$de
clarations.[](3), <dynamic>[new typ::Interface::•(self::$declarations.[](1))])))
; |
| 81 tes::expectTrue(y.length.==(1)); |
| 82 } |
OLD | NEW |