Implement ascend from catch code in vm runner

This commit is contained in:
lash 2023-04-13 10:10:54 +01:00
parent 5e8cacd7bc
commit 28cbe308d4
Signed by untrusted user who does not match committer: lash
GPG Key ID: 21D2E7BB88C2A746
2 changed files with 6 additions and 1 deletions

View File

@ -178,9 +178,13 @@ func(vm *Vm) RunCatch(b []byte, ctx context.Context) ([]byte, error) {
}
if r {
log.Printf("catch at flag %v, moving to %v", sig, sym) //bitField, d)
bh, err := vm.rs.GetCode(sym)
if err != nil {
return b, err
}
vm.st.Down(sym)
vm.ca.Push()
vm.Reset()
bh := NewLine(nil, HALT, nil, nil, nil)
b = append(bh, b...)
}
return b, nil

View File

@ -120,6 +120,7 @@ func(r TestResource) GetCode(sym string) ([]byte, error) {
case "flagCatch":
b = NewLine(b, MOUT, []string{"0", "repent"}, nil, nil)
b = NewLine(b, HALT, nil, nil, nil)
b = NewLine(b, MOVE, []string{"_"}, nil, nil)
}
return b, nil