mirror of
https://github.com/allaunthefox/SilverSight.git
synced 2026-08-18 17:40:35 +00:00
fix(go): simplify execPrim call, remove unnecessary recover closure
This commit is contained in:
parent
3e50e292ba
commit
59a236db73
1 changed files with 2 additions and 7 deletions
|
|
@ -204,13 +204,8 @@ func Step(s State, prog []Instr) (*State, error) {
|
||||||
var b Val
|
var b Val
|
||||||
if arity >= 2 { b = stack[len(stack)-1]; stack = stack[:len(stack)-1] }
|
if arity >= 2 { b = stack[len(stack)-1]; stack = stack[:len(stack)-1] }
|
||||||
a := stack[len(stack)-1]; stack = stack[:len(stack)-1]
|
a := stack[len(stack)-1]; stack = stack[:len(stack)-1]
|
||||||
r, err := func() (Val, error) {
|
r, execErr := execPrim(p, a, b)
|
||||||
defer func() {
|
if execErr != nil { return nil, execErr }
|
||||||
if r := recover(); r != nil { err = errors.New("runtime error in execPrim") }
|
|
||||||
}()
|
|
||||||
return execPrim(p, a, b)
|
|
||||||
}()
|
|
||||||
if err != nil { return nil, err }
|
|
||||||
stack = append(stack, r)
|
stack = append(stack, r)
|
||||||
case Halt:
|
case Halt:
|
||||||
s.Halted = true
|
s.Halted = true
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue