@@ -20,6 +20,7 @@ func (vm *Vm) SET_SECOND(v py.Object) { vm.stack[len(vm.stack)-2] = v }
20
20
func (vm * Vm ) SET_THIRD (v py.Object ) { vm .stack [len (vm .stack )- 3 ] = v }
21
21
func (vm * Vm ) SET_FOURTH (v py.Object ) { vm .stack [len (vm .stack )- 4 ] = v }
22
22
func (vm * Vm ) SET_VALUE (n int , v py.Object ) { vm .stack [len (vm .stack )- (n )] = (v ) }
23
+ func (vm * Vm ) DROP () { vm .stack = vm .stack [:len (vm .stack )- 1 ] }
23
24
func (vm * Vm ) DROPN (n int ) { vm .stack = vm .stack [:len (vm .stack )- n ] }
24
25
25
26
// Pop from top of vm stack
@@ -580,18 +581,26 @@ func do_POP_JUMP_IF_FALSE(vm *Vm, target int32) {
580
581
// If TOS is true, sets the bytecode counter to target and leaves TOS
581
582
// on the stack. Otherwise (TOS is false), TOS is popped.
582
583
func do_JUMP_IF_TRUE_OR_POP (vm * Vm , target int32 ) {
583
- vm .NotImplemented ("JUMP_IF_TRUE_OR_POP" , target )
584
+ if py .MakeBool (vm .TOP ()).(py.Bool ) {
585
+ vm .frame .Lasti = target
586
+ } else {
587
+ vm .DROP ()
588
+ }
584
589
}
585
590
586
591
// If TOS is false, sets the bytecode counter to target and leaves TOS
587
592
// on the stack. Otherwise (TOS is true), TOS is popped.
588
593
func do_JUMP_IF_FALSE_OR_POP (vm * Vm , target int32 ) {
589
- vm .NotImplemented ("JUMP_IF_FALSE_OR_POP" , target )
594
+ if ! py .MakeBool (vm .TOP ()).(py.Bool ) {
595
+ vm .frame .Lasti = target
596
+ } else {
597
+ vm .DROP ()
598
+ }
590
599
}
591
600
592
601
// Set bytecode counter to target.
593
602
func do_JUMP_ABSOLUTE (vm * Vm , target int32 ) {
594
- vm .NotImplemented ( "JUMP_ABSOLUTE" , target )
603
+ vm .frame . Lasti = target
595
604
}
596
605
597
606
// TOS is an iterator. Call its next( ) method. If this yields a new
0 commit comments