blob: bef20c6b107c960b7271c87fbcb96d410f6cb72c [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 {
Entry 0
CheckStack 0
PushConstant CP#0
ReturnTOS
}
ConstantPool {
[0] = ObjectRef const <#lib::A> [const #lib::A {#lib::A::index (field): const 0, #lib::A::_name (field): 'A.elem1'}, const #lib::A {#lib::A::index (field): const 1, #lib::A::_name (field): 'A.elem2'}, const #lib::A {#lib::A::index (field): const 2, #lib::A::_name (field): 'A.elem3'}, const #lib::A {#lib::A::index (field): const 3, #lib::A::_name (field): 'A.elem4'}]
}
] 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 {
Entry 0
CheckStack 0
PushConstant CP#0
ReturnTOS
}
ConstantPool {
[0] = ObjectRef const #lib::A {#lib::A::index (field): const 0, #lib::A::_name (field): 'A.elem1'}
}
] static const field self::A elem1 = const self::A::•(0, "A.elem1");
[@vm.bytecode=
Bytecode {
Entry 0
CheckStack 0
PushConstant CP#0
ReturnTOS
}
ConstantPool {
[0] = ObjectRef const #lib::A {#lib::A::index (field): const 1, #lib::A::_name (field): 'A.elem2'}
}
] static const field self::A elem2 = const self::A::•(1, "A.elem2");
[@vm.bytecode=
Bytecode {
Entry 0
CheckStack 0
PushConstant CP#0
ReturnTOS
}
ConstantPool {
[0] = ObjectRef const #lib::A {#lib::A::index (field): const 2, #lib::A::_name (field): 'A.elem3'}
}
] static const field self::A elem3 = const self::A::•(2, "A.elem3");
[@vm.bytecode=
Bytecode {
Entry 0
CheckStack 0
PushConstant CP#0
ReturnTOS
}
ConstantPool {
[0] = ObjectRef const #lib::A {#lib::A::index (field): const 3, #lib::A::_name (field): 'A.elem4'}
}
] static const field self::A elem4 = const self::A::•(3, "A.elem4");
[@vm.bytecode=
Bytecode {
Entry 0
CheckStack 0
Push FP[-7]
Push FP[-6]
StoreFieldTOS CP#0
Push FP[-7]
Push FP[-5]
StoreFieldTOS CP#2
Push FP[-7]
DirectCall 1, CP#4
Drop1
PushNull
ReturnTOS
}
ConstantPool {
[0] = InstanceField #lib::A::index (field)
[1] = Reserved
[2] = InstanceField #lib::A::_name (field)
[3] = Reserved
[4] = DirectCall 'dart:core::Object:: (constructor)', ArgDesc num-args 1, num-type-args 0, names []
[5] = Reserved
}
] const constructor •(core::int index, core::String _name) self::A
: self::A::index = index, self::A::_name = _name, super core::Object::•()
;
[@vm.bytecode=
Bytecode {
Entry 0
CheckStack 0
Push FP[-5]
DirectCall 1, CP#0
ReturnTOS
}
ConstantPool {
[0] = DirectCall '#lib::A::get:_name', ArgDesc num-args 1, num-type-args 0, names []
[1] = Reserved
}
] method toString() core::String
return this.{=self::A::_name};
}
class B extends core::Object {
final field core::int i;
[@vm.bytecode=
Bytecode {
Entry 0
CheckStack 0
Push FP[-6]
Push FP[-5]
StoreFieldTOS CP#0
Push FP[-6]
DirectCall 1, CP#2
Drop1
PushNull
ReturnTOS
}
ConstantPool {
[0] = InstanceField #lib::B::i (field)
[1] = Reserved
[2] = DirectCall 'dart:core::Object:: (constructor)', ArgDesc num-args 1, num-type-args 0, names []
[3] = Reserved
}
] 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 {
Entry 0
CheckStack 0
Push FP[-8]
Push FP[-7]
Push FP[-6]
AddInt
StoreFieldTOS CP#0
Push FP[-8]
Push FP[-5]
PushInt 5
MulInt
DirectCall 2, CP#2
Drop1
PushNull
ReturnTOS
}
ConstantPool {
[0] = InstanceField #lib::C::j (field)
[1] = Reserved
[2] = DirectCall '#lib::B:: (constructor)', ArgDesc num-args 2, num-type-args 0, names []
[3] = Reserved
}
] 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 {
EntryOptional 2, 1, 0
LoadConstant r2, CP#0
Frame 0
CheckStack 0
Push r0
Push r1
StoreFieldTOS CP#1
Push r0
Push r2
StoreFieldTOS CP#3
Push r0
DirectCall 1, CP#5
Drop1
PushNull
ReturnTOS
}
ConstantPool {
[0] = ObjectRef null
[1] = InstanceField #lib::D::x (field)
[2] = Reserved
[3] = InstanceField #lib::D::y (field)
[4] = Reserved
[5] = DirectCall 'dart:core::Object:: (constructor)', ArgDesc num-args 1, num-type-args 0, names []
[6] = Reserved
}
] 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 {
Entry 0
CheckStack 0
Push FP[-5]
DirectCall 1, CP#0
Drop1
PushNull
ReturnTOS
}
ConstantPool {
[0] = DirectCall 'dart:core::Object:: (constructor)', ArgDesc num-args 1, num-type-args 0, names []
[1] = Reserved
}
] 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 {
Entry 0
CheckStack 0
Push FP[-5]
DirectCall 1, CP#0
Drop1
PushNull
ReturnTOS
}
ConstantPool {
[0] = DirectCall '#lib::E:: (constructor)', ArgDesc num-args 1, num-type-args 0, names []
[1] = Reserved
}
] const constructor •() self::F<self::F::P, self::F::Q>
: super self::E::•()
;
}
[@vm.bytecode=
Bytecode {
Entry 0
CheckStack 0
PushConstant CP#0
ReturnTOS
}
ConstantPool {
[0] = ObjectRef const #lib::A {#lib::A::index (field): const 2, #lib::A::_name (field): 'A.elem3'}
}
]static const field self::A c1 = self::A::elem3;
static const field core::String c2 = "hello!";
[@vm.bytecode=
Bytecode {
Entry 0
CheckStack 0
PushInt 6
ReturnTOS
}
ConstantPool {
}
]static const field core::int c3 = self::c2.{core::String::length};
[@vm.bytecode=
Bytecode {
Entry 0
CheckStack 0
PushConstant CP#0
ReturnTOS
}
ConstantPool {
[0] = ObjectRef const #lib::C {#lib::C::j (field): const 3, #lib::B::i (field): const 15}
}
]static const field self::C c4 = const self::C::•(1, 2, 3);
[@vm.bytecode=
Bytecode {
Entry 0
CheckStack 0
PushConstant CP#0
ReturnTOS
}
ConstantPool {
[0] = ObjectRef const #lib::D {#lib::D::x (field): const #lib::B {#lib::B::i (field): const 4}, #lib::D::y (field): null}
}
]static const field self::D c5 = const self::D::•(const self::B::•(4));
static field core::double fieldWithDoubleLiteralInitializer = 1.0;
[@vm.bytecode=
Bytecode {
Entry 0
CheckStack 0
PushConstant CP#0
DirectCall 1, CP#1
Drop1
PushConstant CP#3
DirectCall 1, CP#1
Drop1
PushInt 6
DirectCall 1, CP#1
Drop1
PushConstant CP#4
DirectCall 1, CP#1
Drop1
PushConstant CP#5
DirectCall 1, CP#1
Drop1
PushNull
ReturnTOS
}
ConstantPool {
[0] = ObjectRef const #lib::A {#lib::A::index (field): const 2, #lib::A::_name (field): 'A.elem3'}
[1] = DirectCall 'dart:core::print', ArgDesc num-args 1, num-type-args 0, names []
[2] = Reserved
[3] = ObjectRef 'hello!'
[4] = ObjectRef const #lib::C {#lib::C::j (field): const 3, #lib::B::i (field): const 15}
[5] = ObjectRef const #lib::D {#lib::D::x (field): const #lib::B {#lib::B::i (field): const 4}, #lib::D::y (field): null}
}
]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 {
Entry 0
CheckStack 0
PushInt 42
DirectCall 1, CP#0
Drop1
PushConstant CP#2
DirectCall 1, CP#0
Drop1
PushConstant CP#3
DirectCall 1, CP#0
Drop1
PushConstant CP#4
DirectCall 1, CP#0
Drop1
PushConstant CP#5
DirectCall 1, CP#0
Drop1
PushConstant CP#6
DirectCall 1, CP#0
Drop1
PushNull
ReturnTOS
}
ConstantPool {
[0] = DirectCall 'dart:core::print', ArgDesc num-args 1, num-type-args 0, names []
[1] = Reserved
[2] = ObjectRef 'foo'
[3] = ObjectRef const #lib::A {#lib::A::index (field): const 1, #lib::A::_name (field): 'A.elem2'}
[4] = ObjectRef const <dart:core::Object> [const 42, 'foo', dart:core::int]
[5] = ObjectRef const dart:core::_ImmutableMap < dart:core::String, #lib::A > {dart:core::_ImmutableMap::_kvPairs (field): const <dynamic> ['E2', const #lib::A {#lib::A::index (field): const 1, #lib::A::_name (field): 'A.elem2'}, 'E4', const #lib::A {#lib::A::index (field): const 3, #lib::A::_name (field): 'A.elem4'}]}
[6] = ObjectRef const #lib::D {#lib::D::x (field): const #lib::C {#lib::C::j (field): const 9, #lib::B::i (field): const 30}, #lib::D::y (field): const dart:core::_ImmutableMap < dart:core::String, dart:core::Object > {dart:core::_ImmutableMap::_kvPairs (field): const <dynamic> ['foo', const 42, 'bar', const #lib::B {#lib::B::i (field): const 6}]}}
}
]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 {
Entry 1
CheckStack 0
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
DirectCall 2, CP#1
DirectCall 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]
InterfaceCall 1, CP#7
StoreIndexedTOS
Push r0
PushInt 2
PushConstant CP#9
StoreIndexedTOS
DirectCall 2, CP#1
DirectCall 1, CP#3
Drop1
PushNull
ReturnTOS
}
ConstantPool {
[0] = ObjectRef < dart:core::int >
[1] = DirectCall 'dart:core::List::_fromLiteral (constructor)', ArgDesc num-args 2, num-type-args 0, names []
[2] = Reserved
[3] = DirectCall 'dart:core::print', ArgDesc num-args 1, num-type-args 0, names []
[4] = Reserved
[5] = ObjectRef < dart:core::String >
[6] = ObjectRef 'a'
[7] = InterfaceCall 'dart:core::int::toString', ArgDesc num-args 1, num-type-args 0, names []
[8] = Reserved
[9] = ObjectRef 'b'
}
]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 {
Entry 2
CheckStack 0
CheckFunctionTypeArgs 1, r0
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
DirectCall 2, CP#2
DirectCall 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]
InterfaceCall 1, CP#8
StoreIndexedTOS
Push r1
PushInt 3
PushInt 3
StoreIndexedTOS
DirectCall 2, CP#2
DirectCall 1, CP#4
Drop1
PushNull
Push r0
InstantiateTypeArgumentsTOS 0, CP#10
PushConstant CP#11
DirectCall 2, CP#2
DirectCall 1, CP#4
Drop1
PushNull
Push r0
InstantiateTypeArgumentsTOS 0, CP#12
PushConstant CP#1
PushInt 2
CreateArrayTOS
StoreLocal r1
Push r1
PushInt 0
Push FP[-5]
StoreIndexedTOS
Push r1
PushInt 1
PushInt 4
StoreIndexedTOS
DirectCall 2, CP#2
DirectCall 1, CP#4
Drop1
PushNull
ReturnTOS
}
ConstantPool {
[0] = ObjectRef < dart:core::int, dart:core::int >
[1] = ObjectRef < dynamic >
[2] = DirectCall 'dart:core::Map::_fromLiteral (constructor)', ArgDesc num-args 2, num-type-args 0, names []
[3] = Reserved
[4] = DirectCall 'dart:core::print', ArgDesc num-args 1, num-type-args 0, names []
[5] = Reserved
[6] = ObjectRef < dart:core::String, dart:core::int >
[7] = ObjectRef 'foo'
[8] = InterfaceCall 'dart:core::int::toString', ArgDesc num-args 1, num-type-args 0, names []
[9] = Reserved
[10] = ObjectRef < dart:core::String, #lib::test_map_literal::TypeParam/0 >
[11] = ObjectRef const <dynamic> []
[12] = ObjectRef < #lib::test_map_literal::TypeParam/0, dart:core::int >
}
]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 {
Entry 0
CheckStack 0
PushConstant CP#0
DirectCall 1, CP#1
Drop1
PushConstant CP#3
DirectCall 1, CP#1
Drop1
PushNull
ReturnTOS
}
ConstantPool {
[0] = ObjectRef const 'test_symbol'
[1] = DirectCall 'dart:core::print', ArgDesc num-args 1, num-type-args 0, names []
[2] = Reserved
[3] = ObjectRef const '_private_symbol'
}
]static method test_symbol() void {
core::print(#test_symbol);
core::print(#_private_symbol);
}
[@vm.bytecode=
Bytecode {
Entry 1
CheckStack 0
CheckFunctionTypeArgs 1, r0
PushConstant CP#0
DirectCall 1, CP#1
Drop1
PushNull
Push r0
InstantiateType CP#3
DirectCall 1, CP#1
Drop1
PushNull
ReturnTOS
}
ConstantPool {
[0] = Type dart:core::String
[1] = DirectCall 'dart:core::print', ArgDesc num-args 1, num-type-args 0, names []
[2] = Reserved
[3] = Type #lib::test_type_literal::TypeParam/0
}
]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 {
Entry 0
CheckStack 0
PushConstant CP#0
ReturnTOS
}
ConstantPool {
[0] = ObjectRef const #lib::F < dart:core::Map < dart:core::int, dart:core::String >, dart:core::int, dart:core::String > {}
}
]static method testGenericConstInstance() dynamic
return const self::F::•<core::int, core::String>();
[@vm.bytecode=
Bytecode {
Entry 0
CheckStack 0
PushConstant CP#0
ReturnTOS
}
ConstantPool {
[0] = Type FunctionType <dart:core::Object X> (null::TypeParam/0) -> null::TypeParam/0
}
]static method testGenericFunctionTypeLiteral() dynamic
return <X extends core::Object = dynamic>(X) X;
[@vm.bytecode=
Bytecode {
Entry 0
CheckStack 0
PushConstant CP#0
PushStatic CP#0
ReturnTOS
}
ConstantPool {
[0] = StaticField #lib::fieldWithDoubleLiteralInitializer (field)
}
]static method testFieldWithDoubleLiteralInitializer() dynamic
return self::fieldWithDoubleLiteralInitializer;
[@vm.bytecode=
Bytecode {
Entry 0
CheckStack 0
PushNull
ReturnTOS
}
ConstantPool {
}
]static method main() dynamic {}