library #lib; import self as self; import "dart:core" as core; [@vm.bytecode= Bytecode { Entry 2 CheckStack PushInt 0 PopLocal r0 PushInt 0 PopLocal r1 L2: CheckStack Push r1 Push FP[-5] InstanceCall 1, CP#1 CompareIntLt AssertBoolean 0 JumpIfFalse L1 Push r0 Push FP[-5] Push r1 InstanceCall 2, CP#3 AddInt PopLocal r0 Push r1 PushInt 1 AddInt StoreLocal r1 Drop1 Jump L2 L1: Push r0 ReturnTOS PushNull ReturnTOS } ConstantPool { [0] = ArgDesc num-args 1, num-type-args 0, names [] [1] = ICData get target-name 'length', arg-desc CP#0 [2] = ArgDesc num-args 2, num-type-args 0, names [] [3] = ICData target-name '[]', arg-desc CP#2 } ]static method test_for(core::List 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 PushInt 0 PopLocal r0 PushInt 0 PopLocal r1 L3: CheckStack Push r1 PushInt 0 CompareIntGe AssertBoolean 0 JumpIfFalse L1 Push r1 Push FP[-5] InstanceCall 1, CP#1 CompareIntGe AssertBoolean 0 JumpIfFalse L2 Jump L1 L2: Push r0 Push FP[-5] Push r1 InstanceCall 2, CP#3 AddInt PopLocal r0 Push r1 PushInt 1 AddInt StoreLocal r1 Drop1 Jump L3 L1: Push r0 ReturnTOS PushNull ReturnTOS } ConstantPool { [0] = ArgDesc num-args 1, num-type-args 0, names [] [1] = ICData get target-name 'length', arg-desc CP#0 [2] = ArgDesc num-args 2, num-type-args 0, names [] [3] = ICData target-name '[]', arg-desc CP#2 } ]static method test_for_break(core::List 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 PushInt 0 PopLocal r0 PushInt 100 NegateInt PopLocal r1 L4: CheckStack Push r1 Push FP[-5] InstanceCall 1, CP#1 CompareIntLt AssertBoolean 0 JumpIfFalse L1 Push r1 PushInt 0 CompareIntLt AssertBoolean 0 JumpIfFalse L2 Jump L3 L2: Push r0 Push FP[-5] Push r1 InstanceCall 2, CP#3 AddInt PopLocal r0 L3: Push r1 PushInt 1 AddInt StoreLocal r1 Drop1 Jump L4 L1: Push r0 ReturnTOS PushNull ReturnTOS } ConstantPool { [0] = ArgDesc num-args 1, num-type-args 0, names [] [1] = ICData get target-name 'length', arg-desc CP#0 [2] = ArgDesc num-args 2, num-type-args 0, names [] [3] = ICData target-name '[]', arg-desc CP#2 } ]static method test_for_continue(core::List 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 PushInt 0 PopLocal r0 PushInt 0 PopLocal r1 L2: CheckStack Push r1 Push FP[-5] InstanceCall 1, CP#1 CompareIntLt AssertBoolean 0 JumpIfFalse L1 Push r0 Push FP[-5] Push r1 PopLocal r2 Push r2 PushInt 1 AddInt StoreLocal r1 PopLocal r3 Push r2 InstanceCall 2, CP#3 AddInt PopLocal r0 Jump L2 L1: Push r0 ReturnTOS PushNull ReturnTOS } ConstantPool { [0] = ArgDesc num-args 1, num-type-args 0, names [] [1] = ICData get target-name 'length', arg-desc CP#0 [2] = ArgDesc num-args 2, num-type-args 0, names [] [3] = ICData target-name '[]', arg-desc CP#2 } ]static method test_while(core::List 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 PushInt 0 PopLocal r0 PushInt 0 PopLocal r1 L1: CheckStack Push r0 Push FP[-5] Push r1 InstanceCall 2, CP#1 AddInt PopLocal r0 Push r1 PushInt 1 AddInt PopLocal r1 Push r1 Push FP[-5] InstanceCall 1, CP#3 CompareIntLt AssertBoolean 0 JumpIfTrue L1 Push r0 ReturnTOS PushNull ReturnTOS } ConstantPool { [0] = ArgDesc num-args 2, num-type-args 0, names [] [1] = ICData target-name '[]', arg-desc CP#0 [2] = ArgDesc num-args 1, num-type-args 0, names [] [3] = ICData get target-name 'length', arg-desc CP#2 } ]static method test_do_while(core::List 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 PushInt 0 PopLocal r0 Push FP[-5] InstanceCall 1, CP#1 PopLocal r1 L2: CheckStack Push r1 InstanceCall 1, CP#2 JumpIfFalse L1 Push r1 InstanceCall 1, CP#3 PopLocal r2 Push r0 Push r2 AddInt PopLocal r0 Jump L2 L1: Push r0 ReturnTOS PushNull ReturnTOS } ConstantPool { [0] = ArgDesc num-args 1, num-type-args 0, names [] [1] = ICData get target-name 'iterator', arg-desc CP#0 [2] = ICData target-name 'moveNext', arg-desc CP#0 [3] = ICData get target-name 'current', arg-desc CP#0 } ]static method test_for_in(core::List 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 PushInt 0 PopLocal r0 PushInt 42 PopLocal r1 Push FP[-5] InstanceCall 1, CP#1 PopLocal r2 L2: CheckStack Push r2 InstanceCall 1, CP#2 JumpIfFalse L1 Push r2 InstanceCall 1, CP#3 PopLocal r3 Push r3 PopLocal r1 Push r0 Push r1 AddInt PopLocal r0 Jump L2 L1: Push r0 ReturnTOS PushNull ReturnTOS } ConstantPool { [0] = ArgDesc num-args 1, num-type-args 0, names [] [1] = ICData get target-name 'iterator', arg-desc CP#0 [2] = ICData target-name 'moveNext', arg-desc CP#0 [3] = ICData get target-name 'current', arg-desc CP#0 } ]static method test_for_in_with_outer_var(core::List 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 PushNull ReturnTOS } ConstantPool { } ]static method main() → dynamic {}