commit 28cbe308d430557c6d312d7ed481303ba2887944
parent 5e8cacd7bc63ba7f76680510d2268a20f8635f25
Author: lash <dev@holbrook.no>
Date: Thu, 13 Apr 2023 10:10:54 +0100
Implement ascend from catch code in vm runner
Diffstat:
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/vm/runner.go b/vm/runner.go
@@ -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
diff --git a/vm/runner_test.go b/vm/runner_test.go
@@ -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