mirror of
https://github.com/allaunthefox/SilverSight.git
synced 2026-07-31 01:25:21 +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
|
||||
if arity >= 2 { b = stack[len(stack)-1]; stack = stack[:len(stack)-1] }
|
||||
a := stack[len(stack)-1]; stack = stack[:len(stack)-1]
|
||||
r, err := func() (Val, error) {
|
||||
defer func() {
|
||||
if r := recover(); r != nil { err = errors.New("runtime error in execPrim") }
|
||||
}()
|
||||
return execPrim(p, a, b)
|
||||
}()
|
||||
if err != nil { return nil, err }
|
||||
r, execErr := execPrim(p, a, b)
|
||||
if execErr != nil { return nil, execErr }
|
||||
stack = append(stack, r)
|
||||
case Halt:
|
||||
s.Halted = true
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue