blob: e5ace827d4754e557f85c7c7dffba6cab0f16162 [file] [log] [blame]
library #lib;
import self as self;
import "dart:core" as core;
typedef GenericFunctionType = <X extends core::Object = dynamic>(X) X;
class A extends core::Object {
final field core::int index;
final field core::String _name;
[@vm.bytecode=
Bytecode (version: stable) {
Entry 0
CheckStack
PushConstant CP#13
ReturnTOS
}
ConstantPool {
[0] = Null
[1] = Int 0
[2] = String 'A.elem1'
[3] = Instance #lib::A type-args CP#0 {index: CP#1, _name: CP#2}
[4] = Int 1
[5] = String 'A.elem2'
[6] = Instance #lib::A type-args CP#0 {index: CP#4, _name: CP#5}
[7] = Int 2
[8] = String 'A.elem3'
[9] = Instance #lib::A type-args CP#0 {index: CP#7, _name: CP#8}
[10] = Int 3
[11] = String 'A.elem4'
[12] = Instance #lib::A type-args CP#0 {index: CP#10, _name: CP#11}
[13] = List type-arg #lib::A, entries CP# [3, 6, 9, 12]
}
] static const field core::List<self::A> values = const <self::A>[self::A::elem1, self::A::elem2, self::A::elem3, self::A::elem4];
[@vm.bytecode=
Bytecode (version: stable) {
Entry 0
CheckStack
PushConstant CP#3
ReturnTOS
}
ConstantPool {
[0] = Null
[1] = Int 0
[2] = String 'A.elem1'
[3] = Instance #lib::A type-args CP#0 {index: CP#1, _name: CP#2}
}
] static const field self::A elem1 = const self::A::•(0, "A.elem1");
[@vm.bytecode=
Bytecode (version: stable) {
Entry 0
CheckStack
PushConstant CP#3
ReturnTOS
}
ConstantPool {
[0] = Null
[1] = Int 1
[2] = String 'A.elem2'
[3] = Instance #lib::A type-args CP#0 {index: CP#1, _name: CP#2}
}
] static const field self::A elem2 = const self::A::•(1, "A.elem2");
[@vm.bytecode=
Bytecode (version: stable) {
Entry 0
CheckStack
PushConstant CP#3
ReturnTOS
}
ConstantPool {
[0] = Null
[1] = Int 2
[2] = String 'A.elem3'
[3] = Instance #lib::A type-args CP#0 {index: CP#1, _name: CP#2}
}
] static const field self::A elem3 = const self::A::•(2, "A.elem3");
[@vm.bytecode=
Bytecode (version: stable) {
Entry 0
CheckStack
PushConstant CP#3
ReturnTOS
}
ConstantPool {
[0] = Null
[1] = Int 3
[2] = String 'A.elem4'
[3] = Instance #lib::A type-args CP#0 {index: CP#1, _name: CP#2}
}
] static const field self::A elem4 = const self::A::•(3, "A.elem4");
[@vm.bytecode=
Bytecode (version: stable) {
Entry 0
CheckStack
Push FP[-7]
Push FP[-6]
StoreFieldTOS CP#0
Push FP[-7]
Push FP[-5]
StoreFieldTOS CP#2
Push FP[-7]
PushConstant CP#5
IndirectStaticCall 1, CP#4
Drop1
PushNull
ReturnTOS
}
ConstantPool {
[0] = InstanceField #lib::A::index
[1] = Reserved
[2] = InstanceField #lib::A::_name
[3] = Reserved
[4] = ArgDesc num-args 1, num-type-args 0, names []
[5] = StaticICData target 'dart.core::Object::', arg-desc CP#4
}
] const constructor •(core::int index, core::String _name) self::A
: self::A::index = index, self::A::_name = _name, super core::Object::•()
;
[@vm.bytecode=
Bytecode (version: stable) {
Entry 0
CheckStack
Push FP[-5]
PushConstant CP#1
IndirectStaticCall 1, CP#0
ReturnTOS
}
ConstantPool {
[0] = ArgDesc num-args 1, num-type-args 0, names []
[1] = StaticICData get target '#lib::A::_name', arg-desc CP#0
}
] method toString() core::String
return this.{=self::A::_name};
}
class B extends core::Object {
final field core::int i;
[@vm.bytecode=
Bytecode (version: stable) {
Entry 0
CheckStack
Push FP[-6]
Push FP[-5]
StoreFieldTOS CP#0
Push FP[-6]
PushConstant CP#3
IndirectStaticCall 1, CP#2
Drop1
PushNull
ReturnTOS
}
ConstantPool {
[0] = InstanceField #lib::B::i
[1] = Reserved
[2] = ArgDesc num-args 1, num-type-args 0, names []
[3] = StaticICData target 'dart.core::Object::', arg-desc CP#2
}
] const constructor •(core::int i) self::B
: self::B::i = i, super core::Object::•()
;
}
class C extends self::B {
final field core::int j;
[@vm.bytecode=
Bytecode (version: stable) {
Entry 0
CheckStack
Push FP[-8]
Push FP[-7]
Push FP[-6]
AddInt
StoreFieldTOS CP#0
Push FP[-8]
Push FP[-5]
PushInt 5
MulInt
PushConstant CP#3
IndirectStaticCall 2, CP#2
Drop1
PushNull
ReturnTOS
}
ConstantPool {
[0] = InstanceField #lib::C::j
[1] = Reserved
[2] = ArgDesc num-args 2, num-type-args 0, names []
[3] = StaticICData target '#lib::B::', arg-desc CP#2
}
] const constructor •(core::int a, core::int b, core::int c) self::C
: self::C::j = a.{core::num::+}(b), super self::B::•(c.{core::num::*}(5))
;
}
class D extends core::Object {
final field dynamic x;
final field dynamic y;
[@vm.bytecode=
Bytecode (version: stable) {
EntryOptional 2, 1, 0
LoadConstant r2, CP#0
Frame 0
CheckStack
Push r0
Push r1
StoreFieldTOS CP#1
Push r0
Push r2
StoreFieldTOS CP#3
Push r0
PushConstant CP#6
IndirectStaticCall 1, CP#5
Drop1
PushNull
ReturnTOS
}
ConstantPool {
[0] = Null
[1] = InstanceField #lib::D::x
[2] = Reserved
[3] = InstanceField #lib::D::y
[4] = Reserved
[5] = ArgDesc num-args 1, num-type-args 0, names []
[6] = StaticICData target 'dart.core::Object::', arg-desc CP#5
}
] const constructor •(dynamic x, [dynamic y = null]) self::D
: self::D::x = x, self::D::y = y, super core::Object::•()
;
}
class E<T extends core::Object = dynamic> extends core::Object {
[@vm.bytecode=
Bytecode (version: stable) {
Entry 0
CheckStack
Push FP[-5]
PushConstant CP#1
IndirectStaticCall 1, CP#0
Drop1
PushNull
ReturnTOS
}
ConstantPool {
[0] = ArgDesc num-args 1, num-type-args 0, names []
[1] = StaticICData target 'dart.core::Object::', arg-desc CP#0
}
] const constructor •() self::E<self::E::T>
: super core::Object::•()
;
}
class F<P extends core::Object = dynamic, Q extends core::Object = dynamic> extends self::E<core::Map<self::F::P, self::F::Q>> {
[@vm.bytecode=
Bytecode (version: stable) {
Entry 0
CheckStack
Push FP[-5]
PushConstant CP#1
IndirectStaticCall 1, CP#0
Drop1
PushNull
ReturnTOS
}
ConstantPool {
[0] = ArgDesc num-args 1, num-type-args 0, names []
[1] = StaticICData target '#lib::E::', arg-desc CP#0
}
] const constructor •() self::F<self::F::P, self::F::Q>
: super self::E::•()
;
}
[@vm.bytecode=
Bytecode (version: stable) {
Entry 0
CheckStack
PushConstant CP#3
ReturnTOS
}
ConstantPool {
[0] = Null
[1] = Int 2
[2] = String 'A.elem3'
[3] = Instance #lib::A type-args CP#0 {index: CP#1, _name: CP#2}
}
]static const field self::A c1 = self::A::elem3;
static const field core::String c2 = "hello!";
[@vm.bytecode=
Bytecode (version: stable) {
Entry 0
CheckStack
PushInt 6
ReturnTOS
}
ConstantPool {
}
]static const field core::int c3 = self::c2.{core::String::length};
[@vm.bytecode=
Bytecode (version: stable) {
Entry 0
CheckStack
PushConstant CP#3
ReturnTOS
}
ConstantPool {
[0] = Null
[1] = Int 3
[2] = Int 15
[3] = Instance #lib::C type-args CP#0 {j: CP#1, i: CP#2}
}
]static const field self::C c4 = const self::C::•(1, 2, 3);
[@vm.bytecode=
Bytecode (version: stable) {
Entry 0
CheckStack
PushConstant CP#3
ReturnTOS
}
ConstantPool {
[0] = Null
[1] = Int 4
[2] = Instance #lib::B type-args CP#0 {i: CP#1}
[3] = Instance #lib::D type-args CP#0 {x: CP#2, y: CP#0}
}
]static const field self::D c5 = const self::D::•(const self::B::•(4));
static field core::double fieldWithDoubleLiteralInitializer = 1.0;
[@vm.bytecode=
Bytecode (version: stable) {
Entry 0
CheckStack
PushConstant CP#3
PushConstant CP#5
IndirectStaticCall 1, CP#4
Drop1
PushConstant CP#6
PushConstant CP#7
IndirectStaticCall 1, CP#4
Drop1
PushInt 6
PushConstant CP#8
IndirectStaticCall 1, CP#4
Drop1
PushConstant CP#11
PushConstant CP#12
IndirectStaticCall 1, CP#4
Drop1
PushConstant CP#15
PushConstant CP#16
IndirectStaticCall 1, CP#4
Drop1
PushNull
ReturnTOS
}
ConstantPool {
[0] = Null
[1] = Int 2
[2] = String 'A.elem3'
[3] = Instance #lib::A type-args CP#0 {index: CP#1, _name: CP#2}
[4] = ArgDesc num-args 1, num-type-args 0, names []
[5] = StaticICData target 'dart.core::print', arg-desc CP#4
[6] = String 'hello!'
[7] = StaticICData target 'dart.core::print', arg-desc CP#4
[8] = StaticICData target 'dart.core::print', arg-desc CP#4
[9] = Int 3
[10] = Int 15
[11] = Instance #lib::C type-args CP#0 {j: CP#9, i: CP#10}
[12] = StaticICData target 'dart.core::print', arg-desc CP#4
[13] = Int 4
[14] = Instance #lib::B type-args CP#0 {i: CP#13}
[15] = Instance #lib::D type-args CP#0 {x: CP#14, y: CP#0}
[16] = StaticICData target 'dart.core::print', arg-desc CP#4
}
]static method test_constants1() void {
core::print(self::c1);
core::print(self::c2);
core::print(self::c3);
core::print(self::c4);
core::print(self::c5);
}
[@vm.bytecode=
Bytecode (version: stable) {
Entry 0
CheckStack
PushInt 42
PushConstant CP#1
IndirectStaticCall 1, CP#0
Drop1
PushConstant CP#2
PushConstant CP#3
IndirectStaticCall 1, CP#0
Drop1
PushConstant CP#7
PushConstant CP#8
IndirectStaticCall 1, CP#0
Drop1
PushConstant CP#11
PushConstant CP#12
IndirectStaticCall 1, CP#0
Drop1
PushConstant CP#20
PushConstant CP#21
IndirectStaticCall 1, CP#0
Drop1
PushConstant CP#31
PushConstant CP#32
IndirectStaticCall 1, CP#0
Drop1
PushNull
ReturnTOS
}
ConstantPool {
[0] = ArgDesc num-args 1, num-type-args 0, names []
[1] = StaticICData target 'dart.core::print', arg-desc CP#0
[2] = String 'foo'
[3] = StaticICData target 'dart.core::print', arg-desc CP#0
[4] = Null
[5] = Int 1
[6] = String 'A.elem2'
[7] = Instance #lib::A type-args CP#4 {index: CP#5, _name: CP#6}
[8] = StaticICData target 'dart.core::print', arg-desc CP#0
[9] = Int 42
[10] = Type dart.core::int
[11] = List type-arg dart.core::Object, entries CP# [9, 2, 10]
[12] = StaticICData target 'dart.core::print', arg-desc CP#0
[13] = TypeArgumentsForInstanceAllocation dart.core::_ImmutableMap [dart.core::String, #lib::A]
[14] = String 'E2'
[15] = String 'E4'
[16] = Int 3
[17] = String 'A.elem4'
[18] = Instance #lib::A type-args CP#4 {index: CP#16, _name: CP#17}
[19] = List type-arg dynamic, entries CP# [14, 7, 15, 18]
[20] = Instance dart.core::_ImmutableMap type-args CP#13 {_kvPairs: CP#19}
[21] = StaticICData target 'dart.core::print', arg-desc CP#0
[22] = Int 9
[23] = Int 30
[24] = Instance #lib::C type-args CP#4 {j: CP#22, i: CP#23}
[25] = TypeArgumentsForInstanceAllocation dart.core::_ImmutableMap [dart.core::String, dart.core::Object]
[26] = String 'bar'
[27] = Int 6
[28] = Instance #lib::B type-args CP#4 {i: CP#27}
[29] = List type-arg dynamic, entries CP# [2, 9, 26, 28]
[30] = Instance dart.core::_ImmutableMap type-args CP#25 {_kvPairs: CP#29}
[31] = Instance #lib::D type-args CP#4 {x: CP#24, y: CP#30}
[32] = StaticICData target 'dart.core::print', arg-desc CP#0
}
]static method test_constants2() void {
core::print(42);
core::print("foo");
core::print(self::A::elem2);
core::print(const <core::Object>[42, "foo", core::int]);
core::print(const <core::String, self::A>{"E2": self::A::elem2, "E4": self::A::elem4});
core::print(const self::D::•(const self::C::•(4, 5, 6), const <core::String, core::Object>{"foo": 42, "bar": const self::B::•(self::c2.{core::String::length})}));
}
[@vm.bytecode=
Bytecode (version: stable) {
Entry 1
CheckStack
PushConstant CP#0
StoreLocal r0
Push r0
PushInt 3
CreateArrayTOS
StoreLocal r0
Push r0
PushInt 0
PushInt 1
StoreIndexedTOS
Push r0
PushInt 1
Push FP[-5]
StoreIndexedTOS
Push r0
PushInt 2
PushInt 3
StoreIndexedTOS
PushConstant CP#2
IndirectStaticCall 2, CP#1
PushConstant CP#4
IndirectStaticCall 1, CP#3
Drop1
PushConstant CP#5
StoreLocal r0
Push r0
PushInt 3
CreateArrayTOS
StoreLocal r0
Push r0
PushInt 0
PushConstant CP#6
StoreIndexedTOS
Push r0
PushInt 1
Push FP[-5]
InstanceCall 1, CP#7
StoreIndexedTOS
Push r0
PushInt 2
PushConstant CP#8
StoreIndexedTOS
PushConstant CP#9
IndirectStaticCall 2, CP#1
PushConstant CP#10
IndirectStaticCall 1, CP#3
Drop1
PushNull
ReturnTOS
}
ConstantPool {
[0] = TypeArgs [dart.core::int]
[1] = ArgDesc num-args 2, num-type-args 0, names []
[2] = StaticICData target 'dart.core::List::_fromLiteral', arg-desc CP#1
[3] = ArgDesc num-args 1, num-type-args 0, names []
[4] = StaticICData target 'dart.core::print', arg-desc CP#3
[5] = TypeArgs [dart.core::String]
[6] = String 'a'
[7] = ICData target-name 'toString', arg-desc CP#3
[8] = String 'b'
[9] = StaticICData target 'dart.core::List::_fromLiteral', arg-desc CP#1
[10] = StaticICData target 'dart.core::print', arg-desc CP#3
}
]static method test_list_literal(core::int a) void {
core::print(<core::int>[1, a, 3]);
core::print(<core::String>["a", a.{core::int::toString}(), "b"]);
}
[@vm.bytecode=
Bytecode (version: stable) {
Entry 2
CheckStack
CheckFunctionTypeArgs 1, 0
PushConstant CP#0
PushConstant CP#1
PushInt 4
CreateArrayTOS
StoreLocal r1
Push r1
PushInt 0
PushInt 1
StoreIndexedTOS
Push r1
PushInt 1
Push FP[-7]
StoreIndexedTOS
Push r1
PushInt 2
Push FP[-6]
StoreIndexedTOS
Push r1
PushInt 3
PushInt 2
StoreIndexedTOS
PushConstant CP#3
IndirectStaticCall 2, CP#2
PushConstant CP#5
IndirectStaticCall 1, CP#4
Drop1
PushConstant CP#6
PushConstant CP#1
PushInt 4
CreateArrayTOS
StoreLocal r1
Push r1
PushInt 0
PushConstant CP#7
StoreIndexedTOS
Push r1
PushInt 1
Push FP[-7]
StoreIndexedTOS
Push r1
PushInt 2
Push FP[-6]
InstanceCall 1, CP#8
StoreIndexedTOS
Push r1
PushInt 3
PushInt 3
StoreIndexedTOS
PushConstant CP#9
IndirectStaticCall 2, CP#2
PushConstant CP#10
IndirectStaticCall 1, CP#4
Drop1
PushNull
Push r0
InstantiateTypeArgumentsTOS 0, CP#11
PushConstant CP#12
PushConstant CP#13
IndirectStaticCall 2, CP#2
PushConstant CP#14
IndirectStaticCall 1, CP#4
Drop1
PushNull
Push r0
InstantiateTypeArgumentsTOS 0, CP#15
PushConstant CP#1
PushInt 2
CreateArrayTOS
StoreLocal r1
Push r1
PushInt 0
Push FP[-5]
StoreIndexedTOS
Push r1
PushInt 1
PushInt 4
StoreIndexedTOS
PushConstant CP#16
IndirectStaticCall 2, CP#2
PushConstant CP#17
IndirectStaticCall 1, CP#4
Drop1
PushNull
ReturnTOS
}
ConstantPool {
[0] = TypeArgs [dart.core::int, dart.core::int]
[1] = TypeArgs [dynamic]
[2] = ArgDesc num-args 2, num-type-args 0, names []
[3] = StaticICData target 'dart.core::Map::_fromLiteral', arg-desc CP#2
[4] = ArgDesc num-args 1, num-type-args 0, names []
[5] = StaticICData target 'dart.core::print', arg-desc CP#4
[6] = TypeArgs [dart.core::String, dart.core::int]
[7] = String 'foo'
[8] = ICData target-name 'toString', arg-desc CP#4
[9] = StaticICData target 'dart.core::Map::_fromLiteral', arg-desc CP#2
[10] = StaticICData target 'dart.core::print', arg-desc CP#4
[11] = TypeArgs [dart.core::String, #lib::test_map_literal::T]
[12] = List type-arg dynamic, entries CP# []
[13] = StaticICData target 'dart.core::Map::_fromLiteral', arg-desc CP#2
[14] = StaticICData target 'dart.core::print', arg-desc CP#4
[15] = TypeArgs [#lib::test_map_literal::T, dart.core::int]
[16] = StaticICData target 'dart.core::Map::_fromLiteral', arg-desc CP#2
[17] = StaticICData target 'dart.core::print', arg-desc CP#4
}
]static method test_map_literal<T extends core::Object = dynamic>(core::int a, core::int b, self::test_map_literal::T c) void {
core::print(<core::int, core::int>{1: a, b: 2});
core::print(<core::String, core::int>{"foo": a, b.{core::int::toString}(): 3});
core::print(<core::String, self::test_map_literal::T>{});
core::print(<self::test_map_literal::T, core::int>{c: 4});
}
[@vm.bytecode=
Bytecode (version: stable) {
Entry 0
CheckStack
PushConstant CP#0
PushConstant CP#2
IndirectStaticCall 1, CP#1
Drop1
PushConstant CP#3
PushConstant CP#4
IndirectStaticCall 1, CP#1
Drop1
PushNull
ReturnTOS
}
ConstantPool {
[0] = Symbol 'test_symbol'
[1] = ArgDesc num-args 1, num-type-args 0, names []
[2] = StaticICData target 'dart.core::print', arg-desc CP#1
[3] = Symbol #lib::'_private_symbol'
[4] = StaticICData target 'dart.core::print', arg-desc CP#1
}
]static method test_symbol() void {
core::print(#test_symbol);
core::print(#_private_symbol);
}
[@vm.bytecode=
Bytecode (version: stable) {
Entry 1
CheckStack
CheckFunctionTypeArgs 1, 0
PushConstant CP#0
PushConstant CP#2
IndirectStaticCall 1, CP#1
Drop1
PushNull
Push r0
InstantiateType CP#3
PushConstant CP#4
IndirectStaticCall 1, CP#1
Drop1
PushNull
ReturnTOS
}
ConstantPool {
[0] = Type dart.core::String
[1] = ArgDesc num-args 1, num-type-args 0, names []
[2] = StaticICData target 'dart.core::print', arg-desc CP#1
[3] = Type #lib::test_type_literal::T
[4] = StaticICData target 'dart.core::print', arg-desc CP#1
}
]static method test_type_literal<T extends core::Object = dynamic>() void {
core::print(core::String);
core::print(self::test_type_literal::T);
}
[@vm.bytecode=
Bytecode (version: stable) {
Entry 0
CheckStack
PushConstant CP#1
ReturnTOS
}
ConstantPool {
[0] = TypeArgumentsForInstanceAllocation #lib::F [dart.core::int, dart.core::String]
[1] = Instance #lib::F type-args CP#0 {}
}
]static method testGenericConstInstance() dynamic
return const self::F::•<core::int, core::String>();
[@vm.bytecode=
Bytecode (version: stable) {
Entry 0
CheckStack
PushConstant CP#0
ReturnTOS
}
ConstantPool {
[0] = Type <X extends dart.core::Object = dynamic>(X) X
}
]static method testGenericFunctionTypeLiteral() dynamic
return <X extends core::Object = dynamic>(X) X;
[@vm.bytecode=
Bytecode (version: stable) {
Entry 0
CheckStack
PushConstant CP#0
PushStatic CP#0
ReturnTOS
}
ConstantPool {
[0] = StaticField #lib::fieldWithDoubleLiteralInitializer
}
]static method testFieldWithDoubleLiteralInitializer() dynamic
return self::fieldWithDoubleLiteralInitializer;
[@vm.bytecode=
Bytecode (version: stable) {
Entry 0
CheckStack
PushNull
ReturnTOS
}
ConstantPool {
}
]static method main() dynamic {}