blob: 4fbdb3b28cfdc0f03a4792fae568d3f8dc57420f [file] [log] [blame]
library #lib;
import self as self;
import "dart:core" as core;
[@vm.bytecode=
Bytecode {
Entry 2
CheckStack 0
PushInt 0
PopLocal r0
PushInt 0
PopLocal r1
L2:
CheckStack 1
Push r1
Push FP[-5]
InterfaceCall 1, CP#1
CompareIntLt
JumpIfFalse L1
Push r0
Push FP[-5]
Push r1
InterfaceCall 2, CP#4
AddInt
PopLocal r0
Push r1
PushInt 1
AddInt
StoreLocal r1
Drop1
Jump L2
L1:
Push r0
ReturnTOS
}
ConstantPool {
[0] = ArgDesc num-args 1, num-type-args 0, names []
[1] = InterfaceCall get target-name 'get:length', arg-desc CP#0
[2] = Reserved
[3] = ArgDesc num-args 2, num-type-args 0, names []
[4] = InterfaceCall target-name '[]', arg-desc CP#3
[5] = Reserved
}
]static method test_for(core::List<core::int> list) core::int {
core::int sum = 0;
for (core::int i = 0; i.{core::num::<}(list.{core::List::length}); i = i.{core::num::+}(1)) {
sum = sum.{core::num::+}(list.{core::List::[]}(i));
}
return sum;
}
[@vm.bytecode=
Bytecode {
Entry 2
CheckStack 0
PushInt 0
PopLocal r0
PushInt 0
PopLocal r1
L3:
CheckStack 1
Push r1
PushInt 0
CompareIntGe
JumpIfFalse L1
Push r1
Push FP[-5]
InterfaceCall 1, CP#1
CompareIntGe
JumpIfFalse L2
Jump L1
L2:
Push r0
Push FP[-5]
Push r1
InterfaceCall 2, CP#4
AddInt
PopLocal r0
Push r1
PushInt 1
AddInt
StoreLocal r1
Drop1
Jump L3
L1:
Push r0
ReturnTOS
}
ConstantPool {
[0] = ArgDesc num-args 1, num-type-args 0, names []
[1] = InterfaceCall get target-name 'get:length', arg-desc CP#0
[2] = Reserved
[3] = ArgDesc num-args 2, num-type-args 0, names []
[4] = InterfaceCall target-name '[]', arg-desc CP#3
[5] = Reserved
}
]static method test_for_break(core::List<core::int> list) core::int {
core::int sum = 0;
#L1:
for (core::int i = 0; i.{core::num::>=}(0); i = i.{core::num::+}(1)) {
if(i.{core::num::>=}(list.{core::List::length})) {
break #L1;
}
sum = sum.{core::num::+}(list.{core::List::[]}(i));
}
return sum;
}
[@vm.bytecode=
Bytecode {
Entry 2
CheckStack 0
PushInt 0
PopLocal r0
PushInt 100
NegateInt
PopLocal r1
L4:
CheckStack 1
Push r1
Push FP[-5]
InterfaceCall 1, CP#1
CompareIntLt
JumpIfFalse L1
Push r1
PushInt 0
CompareIntLt
JumpIfFalse L2
Jump L3
L2:
Push r0
Push FP[-5]
Push r1
InterfaceCall 2, CP#4
AddInt
PopLocal r0
L3:
Push r1
PushInt 1
AddInt
StoreLocal r1
Drop1
Jump L4
L1:
Push r0
ReturnTOS
}
ConstantPool {
[0] = ArgDesc num-args 1, num-type-args 0, names []
[1] = InterfaceCall get target-name 'get:length', arg-desc CP#0
[2] = Reserved
[3] = ArgDesc num-args 2, num-type-args 0, names []
[4] = InterfaceCall target-name '[]', arg-desc CP#3
[5] = Reserved
}
]static method test_for_continue(core::List<core::int> list) core::int {
core::int sum = 0;
for (core::int i = 100.{core::int::unary-}(); i.{core::num::<}(list.{core::List::length}); i = i.{core::num::+}(1))
#L2:
{
if(i.{core::num::<}(0)) {
break #L2;
}
sum = sum.{core::num::+}(list.{core::List::[]}(i));
}
return sum;
}
[@vm.bytecode=
Bytecode {
Entry 4
CheckStack 0
PushInt 0
PopLocal r0
PushInt 0
PopLocal r1
L2:
CheckStack 1
Push r1
Push FP[-5]
InterfaceCall 1, CP#1
CompareIntLt
JumpIfFalse L1
Push r0
Push FP[-5]
Push r1
PopLocal r2
Push r2
PushInt 1
AddInt
StoreLocal r1
PopLocal r3
Push r2
InterfaceCall 2, CP#4
AddInt
PopLocal r0
Jump L2
L1:
Push r0
ReturnTOS
}
ConstantPool {
[0] = ArgDesc num-args 1, num-type-args 0, names []
[1] = InterfaceCall get target-name 'get:length', arg-desc CP#0
[2] = Reserved
[3] = ArgDesc num-args 2, num-type-args 0, names []
[4] = InterfaceCall target-name '[]', arg-desc CP#3
[5] = Reserved
}
]static method test_while(core::List<core::int> list) core::int {
core::int sum = 0;
core::int i = 0;
while (i.{core::num::<}(list.{core::List::length})) {
sum = sum.{core::num::+}(list.{core::List::[]}(let final core::int #t1 = i in let final core::int #t2 = i = #t1.{core::num::+}(1) in #t1));
}
return sum;
}
[@vm.bytecode=
Bytecode {
Entry 2
CheckStack 0
PushInt 0
PopLocal r0
PushInt 0
PopLocal r1
L1:
CheckStack 1
Push r0
Push FP[-5]
Push r1
InterfaceCall 2, CP#1
AddInt
PopLocal r0
Push r1
PushInt 1
AddInt
PopLocal r1
Push r1
Push FP[-5]
InterfaceCall 1, CP#4
CompareIntLt
JumpIfTrue L1
Push r0
ReturnTOS
}
ConstantPool {
[0] = ArgDesc num-args 2, num-type-args 0, names []
[1] = InterfaceCall target-name '[]', arg-desc CP#0
[2] = Reserved
[3] = ArgDesc num-args 1, num-type-args 0, names []
[4] = InterfaceCall get target-name 'get:length', arg-desc CP#3
[5] = Reserved
}
]static method test_do_while(core::List<core::int> list) core::int {
core::int sum = 0;
core::int i = 0;
do {
sum = sum.{core::num::+}(list.{core::List::[]}(i));
i = i.{core::num::+}(1);
}
while (i.{core::num::<}(list.{core::List::length}))
return sum;
}
[@vm.bytecode=
Bytecode {
Entry 3
CheckStack 0
PushInt 0
PopLocal r0
Push FP[-5]
InterfaceCall 1, CP#1
PopLocal r1
L2:
CheckStack 1
Push r1
InterfaceCall 1, CP#3
JumpIfFalse L1
Push r1
InterfaceCall 1, CP#5
PopLocal r2
Push r0
Push r2
AddInt
PopLocal r0
Jump L2
L1:
Push r0
ReturnTOS
}
ConstantPool {
[0] = ArgDesc num-args 1, num-type-args 0, names []
[1] = InterfaceCall get target-name 'get:iterator', arg-desc CP#0
[2] = Reserved
[3] = InterfaceCall target-name 'moveNext', arg-desc CP#0
[4] = Reserved
[5] = InterfaceCall get target-name 'get:current', arg-desc CP#0
[6] = Reserved
}
]static method test_for_in(core::List<core::int> list) core::int {
core::int sum = 0;
for (core::int e in list) {
sum = sum.{core::num::+}(e);
}
return sum;
}
[@vm.bytecode=
Bytecode {
Entry 4
CheckStack 0
PushInt 0
PopLocal r0
PushInt 42
PopLocal r1
Push FP[-5]
InterfaceCall 1, CP#1
PopLocal r2
L2:
CheckStack 1
Push r2
InterfaceCall 1, CP#3
JumpIfFalse L1
Push r2
InterfaceCall 1, CP#5
PopLocal r3
Push r3
PopLocal r1
Push r0
Push r1
AddInt
PopLocal r0
Jump L2
L1:
Push r0
ReturnTOS
}
ConstantPool {
[0] = ArgDesc num-args 1, num-type-args 0, names []
[1] = InterfaceCall get target-name 'get:iterator', arg-desc CP#0
[2] = Reserved
[3] = InterfaceCall target-name 'moveNext', arg-desc CP#0
[4] = Reserved
[5] = InterfaceCall get target-name 'get:current', arg-desc CP#0
[6] = Reserved
}
]static method test_for_in_with_outer_var(core::List<core::int> list) core::int {
core::int sum = 0;
core::int e = 42;
for (final core::int #t3 in list) {
e = #t3;
sum = sum.{core::num::+}(e);
}
return sum;
}
[@vm.bytecode=
Bytecode {
Entry 0
CheckStack 0
PushNull
ReturnTOS
}
ConstantPool {
}
]static method main() dynamic {}