OLD | NEW |
(Empty) | |
| 1 library closure_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 "dart:mock" as mock; |
| 7 import "./test_base.dart" as tes; |
| 8 import "../../runtime/reify/declarations.dart" as dec; |
| 9 |
| 10 class A extends core::Object implements int::HasRuntimeTypeGetter { |
| 11 constructor •() → void |
| 12 : super core::Object::•() |
| 13 ; |
| 14 get $type() → typ::ReifiedType |
| 15 return new typ::Interface::•(self::$declarations.[](0)); |
| 16 } |
| 17 class B extends core::Object implements int::HasRuntimeTypeGetter { |
| 18 constructor •() → void |
| 19 : super core::Object::•() |
| 20 ; |
| 21 get $type() → typ::ReifiedType |
| 22 return new typ::Interface::•(self::$declarations.[](1)); |
| 23 } |
| 24 class Closure#main#foo extends core::Object implements core::Function, int::HasR
untimeTypeGetter { |
| 25 field core::String note = "This is temporary. The VM doesn't need closure clas
ses."; |
| 26 field mock::Context context; |
| 27 constructor •(final mock::Context context) → dynamic |
| 28 : self::Closure#main#foo::context = context |
| 29 ; |
| 30 method call(self::A a) → self::B { |
| 31 "This is a temporary solution. In the VM, this will become an additional par
ameter."; |
| 32 final mock::Context #contextParameter = this.{self::Closure#main#foo::contex
t}; |
| 33 return null; |
| 34 } |
| 35 get $type() → typ::ReifiedType |
| 36 return new typ::Interface::•(self::$declarations.[](2)); |
| 37 } |
| 38 class Closure#main#qux extends core::Object implements core::Function, int::HasR
untimeTypeGetter { |
| 39 field core::String note = "This is temporary. The VM doesn't need closure clas
ses."; |
| 40 field mock::Context context; |
| 41 constructor •(final mock::Context context) → dynamic |
| 42 : self::Closure#main#qux::context = context |
| 43 ; |
| 44 method call(self::B b) → self::A { |
| 45 "This is a temporary solution. In the VM, this will become an additional par
ameter."; |
| 46 final mock::Context #contextParameter = this.{self::Closure#main#qux::contex
t}; |
| 47 return null; |
| 48 } |
| 49 get $type() → typ::ReifiedType |
| 50 return new typ::Interface::•(self::$declarations.[](3)); |
| 51 } |
| 52 class Closure#bar extends core::Object implements core::Function, int::HasRuntim
eTypeGetter { |
| 53 field core::String note = "This is temporary. The VM doesn't need closure clas
ses."; |
| 54 constructor •() → dynamic |
| 55 ; |
| 56 method call(self::A a) → dynamic |
| 57 return self::bar(a); |
| 58 get $type() → typ::ReifiedType |
| 59 return new typ::Interface::•(self::$declarations.[](4)); |
| 60 } |
| 61 class Closure#bar extends core::Object implements core::Function, int::HasRuntim
eTypeGetter { |
| 62 field core::String note = "This is temporary. The VM doesn't need closure clas
ses."; |
| 63 constructor •() → dynamic |
| 64 ; |
| 65 method call(self::A a) → dynamic |
| 66 return self::bar(a); |
| 67 get $type() → typ::ReifiedType |
| 68 return new typ::Interface::•(self::$declarations.[](5)); |
| 69 } |
| 70 class Closure#baz extends core::Object implements core::Function, int::HasRuntim
eTypeGetter { |
| 71 field core::String note = "This is temporary. The VM doesn't need closure clas
ses."; |
| 72 constructor •() → dynamic |
| 73 ; |
| 74 method call(dynamic a) → self::B |
| 75 return self::baz(a); |
| 76 get $type() → typ::ReifiedType |
| 77 return new typ::Interface::•(self::$declarations.[](6)); |
| 78 } |
| 79 class Closure#baz extends core::Object implements core::Function, int::HasRuntim
eTypeGetter { |
| 80 field core::String note = "This is temporary. The VM doesn't need closure clas
ses."; |
| 81 constructor •() → dynamic |
| 82 ; |
| 83 method call(dynamic a) → self::B |
| 84 return self::baz(a); |
| 85 get $type() → typ::ReifiedType |
| 86 return new typ::Interface::•(self::$declarations.[](7)); |
| 87 } |
| 88 class Closure#bar extends core::Object implements core::Function, int::HasRuntim
eTypeGetter { |
| 89 field core::String note = "This is temporary. The VM doesn't need closure clas
ses."; |
| 90 constructor •() → dynamic |
| 91 ; |
| 92 method call(self::A a) → dynamic |
| 93 return self::bar(a); |
| 94 get $type() → typ::ReifiedType |
| 95 return new typ::Interface::•(self::$declarations.[](8)); |
| 96 } |
| 97 class Closure#baz extends core::Object implements core::Function, int::HasRuntim
eTypeGetter { |
| 98 field core::String note = "This is temporary. The VM doesn't need closure clas
ses."; |
| 99 constructor •() → dynamic |
| 100 ; |
| 101 method call(dynamic a) → self::B |
| 102 return self::baz(a); |
| 103 get $type() → typ::ReifiedType |
| 104 return new typ::Interface::•(self::$declarations.[](9)); |
| 105 } |
| 106 static final field core::List<dec::Class> $declarations = (core::List<dec::Class
> d) → core::List<dec::Class> { |
| 107 dec::init(d, 0, new typ::Interface::•(d.[](24))); |
| 108 dec::init(d, 1, new typ::Interface::•(d.[](24))); |
| 109 dec::init(d, 2, new typ::Interface::•(d.[](24)), <dynamic>[new typ::Interface:
:•(d.[](10))], new typ::FunctionType::•(new typ::Interface::•(d.[](10)), new typ
::Interface::•(d.[](1)), 0, <dynamic>[new typ::Interface::•(d.[](0))])); |
| 110 dec::init(d, 3, new typ::Interface::•(d.[](24)), <dynamic>[new typ::Interface:
:•(d.[](10))], new typ::FunctionType::•(new typ::Interface::•(d.[](10)), new typ
::Interface::•(d.[](0)), 0, <dynamic>[new typ::Interface::•(d.[](1))])); |
| 111 dec::init(d, 4, new typ::Interface::•(d.[](24)), <dynamic>[new typ::Interface:
:•(d.[](10))], new typ::FunctionType::•(new typ::Interface::•(d.[](10)), const t
yp::Dynamic::•(), 0, <dynamic>[new typ::Interface::•(d.[](0))])); |
| 112 dec::init(d, 5, new typ::Interface::•(d.[](24)), <dynamic>[new typ::Interface:
:•(d.[](10))], new typ::FunctionType::•(new typ::Interface::•(d.[](10)), const t
yp::Dynamic::•(), 0, <dynamic>[new typ::Interface::•(d.[](0))])); |
| 113 dec::init(d, 6, new typ::Interface::•(d.[](24)), <dynamic>[new typ::Interface:
:•(d.[](10))], new typ::FunctionType::•(new typ::Interface::•(d.[](10)), new typ
::Interface::•(d.[](1)), 0, <dynamic>[const typ::Dynamic::•()])); |
| 114 dec::init(d, 7, new typ::Interface::•(d.[](24)), <dynamic>[new typ::Interface:
:•(d.[](10))], new typ::FunctionType::•(new typ::Interface::•(d.[](10)), new typ
::Interface::•(d.[](1)), 0, <dynamic>[const typ::Dynamic::•()])); |
| 115 dec::init(d, 8, new typ::Interface::•(d.[](24)), <dynamic>[new typ::Interface:
:•(d.[](10))], new typ::FunctionType::•(new typ::Interface::•(d.[](10)), const t
yp::Dynamic::•(), 0, <dynamic>[new typ::Interface::•(d.[](0))])); |
| 116 dec::init(d, 9, new typ::Interface::•(d.[](24)), <dynamic>[new typ::Interface:
:•(d.[](10))], new typ::FunctionType::•(new typ::Interface::•(d.[](10)), new typ
::Interface::•(d.[](1)), 0, <dynamic>[const typ::Dynamic::•()])); |
| 117 dec::init(d, 10, new typ::Interface::•(d.[](24))); |
| 118 dec::init(d, 11, new typ::Interface::•(d.[](24))); |
| 119 dec::init(d, 12, new typ::Interface::•(d.[](24))); |
| 120 dec::init(d, 13, new typ::Interface::•(d.[](24)), <dynamic>[new typ::Interface
::•(d.[](26), <dynamic>[new typ::Interface::•(d.[](13))]), new typ::Interface::•
(d.[](27))]); |
| 121 dec::init(d, 14, new typ::Interface::•(d.[](28))); |
| 122 dec::init(d, 15, new typ::Interface::•(d.[](28))); |
| 123 dec::init(d, 16, new typ::Interface::•(d.[](24))); |
| 124 dec::init(d, 17, new typ::Interface::•(d.[](29))); |
| 125 dec::init(d, 18, new typ::Interface::•(d.[](29))); |
| 126 dec::init(d, 19, new typ::Interface::•(d.[](29))); |
| 127 dec::init(d, 20, new typ::Interface::•(d.[](29))); |
| 128 dec::init(d, 21, new typ::Interface::•(d.[](24)), <dynamic>[new typ::Interface
::•(d.[](30))]); |
| 129 dec::init(d, 22, new typ::Interface::•(d.[](23))); |
| 130 dec::init(d, 23, new typ::Interface::•(d.[](29))); |
| 131 dec::init(d, 24, null); |
| 132 dec::init(d, 26, new typ::Interface::•(d.[](24))); |
| 133 dec::init(d, 27, new typ::Interface::•(d.[](24))); |
| 134 dec::init(d, 28, new typ::Interface::•(d.[](24)), <dynamic>[new typ::Interface
::•(d.[](26), <dynamic>[new typ::Interface::•(d.[](28))])]); |
| 135 dec::init(d, 29, new typ::Interface::•(d.[](24))); |
| 136 dec::init(d, 30, new typ::Interface::•(d.[](24))); |
| 137 return d; |
| 138 }.call(dec::allocateDeclarations(<dynamic>["A", "B", "Closure#main#foo", "Closur
e#main#qux", "Closure#bar", "Closure#bar", "Closure#baz", "Closure#baz", "Closur
e#bar", "Closure#baz", "Function", "Null", "bool", "String", "int", "double", "T
ype", "AbstractClassInstantiationError", "NoSuchMethodError", "CyclicInitializat
ionError", "UnsupportedError", "IntegerDivisionByZeroException", "RangeError", "
ArgumentError", "Object", "HasRuntimeTypeGetter", "Comparable", "Pattern", "num"
, "Error", "Exception"], <dynamic>[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0])); |
| 139 static method bar(self::A a) → dynamic { |
| 140 return null; |
| 141 } |
| 142 static method baz(dynamic a) → self::B { |
| 143 return null; |
| 144 } |
| 145 static method main() → dynamic { |
| 146 final (self::A) → self::B foo = new self::Closure#main#foo::•(null); |
| 147 final (self::B) → self::A qux = new self::Closure#main#qux::•(null); |
| 148 tes::expectTrue(typ::isSubtypeOf(int::type(foo), new typ::FunctionType::•(new
typ::Interface::•(self::$declarations.[](10)), new typ::Interface::•(self::$decl
arations.[](1)), 0, <dynamic>[new typ::Interface::•(self::$declarations.[](0))])
)); |
| 149 tes::expectTrue(!typ::isSubtypeOf(int::type(qux), new typ::FunctionType::•(new
typ::Interface::•(self::$declarations.[](10)), new typ::Interface::•(self::$dec
larations.[](1)), 0, <dynamic>[new typ::Interface::•(self::$declarations.[](0))]
))); |
| 150 tes::expectTrue(!typ::isSubtypeOf(int::type(foo), new typ::FunctionType::•(new
typ::Interface::•(self::$declarations.[](10)), new typ::Interface::•(self::$dec
larations.[](0)), 0, <dynamic>[new typ::Interface::•(self::$declarations.[](1))]
))); |
| 151 tes::expectTrue(typ::isSubtypeOf(int::type(qux), new typ::FunctionType::•(new
typ::Interface::•(self::$declarations.[](10)), new typ::Interface::•(self::$decl
arations.[](0)), 0, <dynamic>[new typ::Interface::•(self::$declarations.[](1))])
)); |
| 152 tes::expectTrue(typ::isSubtypeOf(int::type(new self::Closure#bar::•()), new ty
p::FunctionType::•(new typ::Interface::•(self::$declarations.[](10)), new typ::I
nterface::•(self::$declarations.[](1)), 0, <dynamic>[new typ::Interface::•(self:
:$declarations.[](0))]))); |
| 153 tes::expectTrue(!typ::isSubtypeOf(int::type(new self::Closure#bar::•()), new t
yp::FunctionType::•(new typ::Interface::•(self::$declarations.[](10)), new typ::
Interface::•(self::$declarations.[](0)), 0, <dynamic>[new typ::Interface::•(self
::$declarations.[](1))]))); |
| 154 tes::expectTrue(typ::isSubtypeOf(int::type(new self::Closure#baz::•()), new ty
p::FunctionType::•(new typ::Interface::•(self::$declarations.[](10)), new typ::I
nterface::•(self::$declarations.[](1)), 0, <dynamic>[new typ::Interface::•(self:
:$declarations.[](0))]))); |
| 155 tes::expectTrue(!typ::isSubtypeOf(int::type(new self::Closure#baz::•()), new t
yp::FunctionType::•(new typ::Interface::•(self::$declarations.[](10)), new typ::
Interface::•(self::$declarations.[](0)), 0, <dynamic>[new typ::Interface::•(self
::$declarations.[](1))]))); |
| 156 dynamic rab = new self::Closure#bar::•(); |
| 157 dynamic zab = new self::Closure#baz::•(); |
| 158 tes::expectTrue(typ::isSubtypeOf(int::type(rab), new typ::FunctionType::•(new
typ::Interface::•(self::$declarations.[](10)), new typ::Interface::•(self::$decl
arations.[](1)), 0, <dynamic>[new typ::Interface::•(self::$declarations.[](0))])
)); |
| 159 tes::expectTrue(!typ::isSubtypeOf(int::type(rab), new typ::FunctionType::•(new
typ::Interface::•(self::$declarations.[](10)), new typ::Interface::•(self::$dec
larations.[](0)), 0, <dynamic>[new typ::Interface::•(self::$declarations.[](1))]
))); |
| 160 tes::expectTrue(typ::isSubtypeOf(int::type(zab), new typ::FunctionType::•(new
typ::Interface::•(self::$declarations.[](10)), new typ::Interface::•(self::$decl
arations.[](1)), 0, <dynamic>[new typ::Interface::•(self::$declarations.[](0))])
)); |
| 161 tes::expectTrue(!typ::isSubtypeOf(int::type(zab), new typ::FunctionType::•(new
typ::Interface::•(self::$declarations.[](10)), new typ::Interface::•(self::$dec
larations.[](0)), 0, <dynamic>[new typ::Interface::•(self::$declarations.[](1))]
))); |
| 162 } |
OLD | NEW |