OLD | NEW |
(Empty) | |
| 1 library simple_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 C 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$A() → core::bool |
| 16 return false; |
| 17 get $is$B() → core::bool |
| 18 return false; |
| 19 get $is$C() → core::bool |
| 20 return true; |
| 21 get $is$D() → core::bool |
| 22 return false; |
| 23 } |
| 24 class A extends core::Object implements self::C, int::HasRuntimeTypeGetter { |
| 25 constructor •() → void |
| 26 : super core::Object::•() |
| 27 ; |
| 28 get $type() → typ::ReifiedType |
| 29 return new typ::Interface::•(self::$declarations.[](1)); |
| 30 get $is$A() → core::bool |
| 31 return true; |
| 32 get $is$B() → core::bool |
| 33 return false; |
| 34 get $is$C() → core::bool |
| 35 return true; |
| 36 get $is$D() → core::bool |
| 37 return false; |
| 38 } |
| 39 class B extends self::C implements int::HasRuntimeTypeGetter { |
| 40 constructor •() → void |
| 41 : super self::C::•() |
| 42 ; |
| 43 get $type() → typ::ReifiedType |
| 44 return new typ::Interface::•(self::$declarations.[](2)); |
| 45 get $is$A() → core::bool |
| 46 return false; |
| 47 get $is$B() → core::bool |
| 48 return true; |
| 49 get $is$C() → core::bool |
| 50 return true; |
| 51 get $is$D() → core::bool |
| 52 return false; |
| 53 } |
| 54 class D extends self::B implements int::HasRuntimeTypeGetter { |
| 55 constructor •() → void |
| 56 : super self::B::•() |
| 57 ; |
| 58 get $type() → typ::ReifiedType |
| 59 return new typ::Interface::•(self::$declarations.[](3)); |
| 60 get $is$A() → core::bool |
| 61 return false; |
| 62 get $is$B() → core::bool |
| 63 return true; |
| 64 get $is$C() → core::bool |
| 65 return true; |
| 66 get $is$D() → core::bool |
| 67 return true; |
| 68 } |
| 69 class Closure#testIs extends core::Object implements core::Function, int::HasRun
timeTypeGetter { |
| 70 field core::String note = "This is temporary. The VM doesn't need closure clas
ses."; |
| 71 constructor •() → dynamic |
| 72 ; |
| 73 method call(dynamic o) → dynamic |
| 74 return self::testIs(o); |
| 75 get $type() → typ::ReifiedType |
| 76 return new typ::Interface::•(self::$declarations.[](4)); |
| 77 get $is$A() → core::bool |
| 78 return false; |
| 79 get $is$B() → core::bool |
| 80 return false; |
| 81 get $is$C() → core::bool |
| 82 return false; |
| 83 get $is$D() → core::bool |
| 84 return false; |
| 85 } |
| 86 class Closure#testIsNot extends core::Object implements core::Function, int::Has
RuntimeTypeGetter { |
| 87 field core::String note = "This is temporary. The VM doesn't need closure clas
ses."; |
| 88 constructor •() → dynamic |
| 89 ; |
| 90 method call(dynamic o) → dynamic |
| 91 return self::testIsNot(o); |
| 92 get $type() → typ::ReifiedType |
| 93 return new typ::Interface::•(self::$declarations.[](5)); |
| 94 get $is$A() → core::bool |
| 95 return false; |
| 96 get $is$B() → core::bool |
| 97 return false; |
| 98 get $is$C() → core::bool |
| 99 return false; |
| 100 get $is$D() → core::bool |
| 101 return false; |
| 102 } |
| 103 static final field core::List<dec::Class> $declarations = (core::List<dec::Class
> d) → core::List<dec::Class> { |
| 104 dec::init(d, 0, new typ::Interface::•(d.[](20))); |
| 105 dec::init(d, 1, new typ::Interface::•(d.[](20)), <dynamic>[new typ::Interface:
:•(d.[](0))]); |
| 106 dec::init(d, 2, new typ::Interface::•(d.[](0))); |
| 107 dec::init(d, 3, new typ::Interface::•(d.[](2))); |
| 108 dec::init(d, 4, new typ::Interface::•(d.[](20)), <dynamic>[new typ::Interface:
:•(d.[](22))], new typ::FunctionType::•(new typ::Interface::•(d.[](22)), const t
yp::Dynamic::•(), 0, <dynamic>[const typ::Dynamic::•()])); |
| 109 dec::init(d, 5, new typ::Interface::•(d.[](20)), <dynamic>[new typ::Interface:
:•(d.[](22))], new typ::FunctionType::•(new typ::Interface::•(d.[](22)), const t
yp::Dynamic::•(), 0, <dynamic>[const typ::Dynamic::•()])); |
| 110 dec::init(d, 6, new typ::Interface::•(d.[](20)), <dynamic>[new typ::Interface:
:•(d.[](23), <dynamic>[d.[](6).variables.[](0)])]); |
| 111 dec::init(d, 7, new typ::Interface::•(d.[](20))); |
| 112 dec::init(d, 8, new typ::Interface::•(d.[](20))); |
| 113 dec::init(d, 9, new typ::Interface::•(d.[](20)), <dynamic>[new typ::Interface:
:•(d.[](24), <dynamic>[new typ::Interface::•(d.[](9))]), new typ::Interface::•(d
.[](25))]); |
| 114 dec::init(d, 10, new typ::Interface::•(d.[](26))); |
| 115 dec::init(d, 11, new typ::Interface::•(d.[](26))); |
| 116 dec::init(d, 12, new typ::Interface::•(d.[](20))); |
| 117 dec::init(d, 13, new typ::Interface::•(d.[](27))); |
| 118 dec::init(d, 14, new typ::Interface::•(d.[](27))); |
| 119 dec::init(d, 15, new typ::Interface::•(d.[](27))); |
| 120 dec::init(d, 16, new typ::Interface::•(d.[](27))); |
| 121 dec::init(d, 17, new typ::Interface::•(d.[](20)), <dynamic>[new typ::Interface
::•(d.[](28))]); |
| 122 dec::init(d, 18, new typ::Interface::•(d.[](19))); |
| 123 dec::init(d, 19, new typ::Interface::•(d.[](27))); |
| 124 dec::init(d, 20, null); |
| 125 dec::init(d, 22, new typ::Interface::•(d.[](20))); |
| 126 dec::init(d, 23, new typ::Interface::•(d.[](29), <dynamic>[d.[](23).variables.
[](0)])); |
| 127 dec::init(d, 24, new typ::Interface::•(d.[](20))); |
| 128 dec::init(d, 25, new typ::Interface::•(d.[](20))); |
| 129 dec::init(d, 26, new typ::Interface::•(d.[](20)), <dynamic>[new typ::Interface
::•(d.[](24), <dynamic>[new typ::Interface::•(d.[](26))])]); |
| 130 dec::init(d, 27, new typ::Interface::•(d.[](20))); |
| 131 dec::init(d, 28, new typ::Interface::•(d.[](20))); |
| 132 dec::init(d, 29, new typ::Interface::•(d.[](20))); |
| 133 return d; |
| 134 }.call(dec::allocateDeclarations(<dynamic>["C", "A", "B", "D", "Closure#testIs",
"Closure#testIsNot", "List", "Null", "bool", "String", "int", "double", "Type",
"AbstractClassInstantiationError", "NoSuchMethodError", "CyclicInitializationEr
ror", "UnsupportedError", "IntegerDivisionByZeroException", "RangeError", "Argum
entError", "Object", "HasRuntimeTypeGetter", "Function", "EfficientLengthIterabl
e", "Comparable", "Pattern", "num", "Error", "Exception", "Iterable"], <dynamic>
[0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0
, 0, 0, 1])); |
| 135 static method testIs(dynamic o) → dynamic { |
| 136 tes::write(let dynamic #t1 = o in #t1 is int::HasRuntimeTypeGetter && #t1.$is$
A); |
| 137 tes::write(let dynamic #t2 = o in #t2 is int::HasRuntimeTypeGetter && #t2.$is$
B); |
| 138 tes::write(let dynamic #t3 = o in #t3 is int::HasRuntimeTypeGetter && #t3.$is$
C); |
| 139 tes::write(let dynamic #t4 = o in #t4 is int::HasRuntimeTypeGetter && #t4.$is$
D); |
| 140 } |
| 141 static method testIsNot(dynamic o) → dynamic { |
| 142 tes::write(!(let dynamic #t5 = o in #t5 is int::HasRuntimeTypeGetter && #t5.$i
s$A)); |
| 143 tes::write(!(let dynamic #t6 = o in #t6 is int::HasRuntimeTypeGetter && #t6.$i
s$B)); |
| 144 tes::write(!(let dynamic #t7 = o in #t7 is int::HasRuntimeTypeGetter && #t7.$i
s$C)); |
| 145 tes::write(!(let dynamic #t8 = o in #t8 is int::HasRuntimeTypeGetter && #t8.$i
s$D)); |
| 146 } |
| 147 static method main() → dynamic { |
| 148 dynamic objects = int::attachType(<dynamic>[new self::A::•(), new self::B::•()
, new self::C::•(), new self::D::•()], new typ::Interface::•(self::$declarations
.[](6), <dynamic>[const typ::Dynamic::•()])); |
| 149 objects.forEach(new self::Closure#testIs::•()); |
| 150 objects.forEach(new self::Closure#testIsNot::•()); |
| 151 tes::expectOutput("true\nfalse\ntrue\nfalse\nfalse\ntrue\ntrue\nfalse\nfalse\n
false\ntrue\nfalse\nfalse\ntrue\ntrue\ntrue\nfalse\ntrue\nfalse\ntrue\ntrue\nfal
se\nfalse\ntrue\ntrue\ntrue\nfalse\ntrue\ntrue\nfalse\nfalse\nfalse"); |
| 152 } |
OLD | NEW |