vm: make StepOut/StepOver match original VM behavior

This commit is contained in:
Evgenii Stratonikov 2019-11-06 12:24:02 +03:00
parent 9ebb793009
commit 7d40d2f71e

View file

@ -376,7 +376,7 @@ func (v *VM) StepOut() error {
} }
expSize := v.istack.len expSize := v.istack.len
for v.state.HasFlag(noneState) && v.istack.len >= expSize { for v.state == noneState && v.istack.len >= expSize {
err = v.StepInto() err = v.StepInto()
} }
return err return err
@ -399,10 +399,15 @@ func (v *VM) StepOver() error {
expSize := v.istack.len expSize := v.istack.len
for { for {
err = v.StepInto() err = v.StepInto()
if !(v.state.HasFlag(noneState) && v.istack.len > expSize) { if !(v.state == noneState && v.istack.len > expSize) {
break break
} }
} }
if v.state == noneState {
v.state = breakState
}
return err return err
} }