Flush code buffer on catch
This commit is contained in:
parent
ed9cd8d7b4
commit
57bb9af940
3
examples/profile/identified
Normal file
3
examples/profile/identified
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
You are identified as:
|
||||||
|
Name: {{.myname}}
|
||||||
|
Email: {{.myemail}}
|
2
examples/profile/identified.vis
Normal file
2
examples/profile/identified.vis
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
MAP myname
|
||||||
|
MAP myemail
|
@ -191,7 +191,8 @@ func(vm *Vm) RunCatch(b []byte, ctx context.Context) ([]byte, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return b, err
|
return b, err
|
||||||
}
|
}
|
||||||
b = append(bh, b...)
|
//b = append(bh, b...)
|
||||||
|
b = bh
|
||||||
vm.st.Down(sym)
|
vm.st.Down(sym)
|
||||||
vm.ca.Push()
|
vm.ca.Push()
|
||||||
vm.Reset()
|
vm.Reset()
|
||||||
|
@ -18,6 +18,7 @@ var dynVal = "three"
|
|||||||
type TestResource struct {
|
type TestResource struct {
|
||||||
resource.MenuResource
|
resource.MenuResource
|
||||||
state *state.State
|
state *state.State
|
||||||
|
RootCode []byte
|
||||||
}
|
}
|
||||||
|
|
||||||
func getOne(sym string, input []byte, ctx context.Context) (resource.Result, error) {
|
func getOne(sym string, input []byte, ctx context.Context) (resource.Result, error) {
|
||||||
@ -121,6 +122,8 @@ func(r TestResource) GetCode(sym string) ([]byte, error) {
|
|||||||
b = NewLine(b, MOUT, []string{"0", "repent"}, nil, nil)
|
b = NewLine(b, MOUT, []string{"0", "repent"}, nil, nil)
|
||||||
b = NewLine(b, HALT, nil, nil, nil)
|
b = NewLine(b, HALT, nil, nil, nil)
|
||||||
b = NewLine(b, MOVE, []string{"_"}, nil, nil)
|
b = NewLine(b, MOVE, []string{"_"}, nil, nil)
|
||||||
|
case "root":
|
||||||
|
b = r.RootCode
|
||||||
}
|
}
|
||||||
|
|
||||||
return b, nil
|
return b, nil
|
||||||
@ -495,10 +498,13 @@ func TestInputBranch(t *testing.T) {
|
|||||||
st.Down("root")
|
st.Down("root")
|
||||||
|
|
||||||
b := NewLine(nil, LOAD, []string{"setFlagOne"}, []byte{0x00}, nil)
|
b := NewLine(nil, LOAD, []string{"setFlagOne"}, []byte{0x00}, nil)
|
||||||
b = NewLine(b, CATCH, []string{"flagCatch"}, []byte{8}, []uint8{0})
|
|
||||||
b = NewLine(b, RELOAD, []string{"setFlagOne"}, nil, nil)
|
b = NewLine(b, RELOAD, []string{"setFlagOne"}, nil, nil)
|
||||||
b = NewLine(b, CATCH, []string{"flagCatch"}, []byte{8}, []uint8{0})
|
b = NewLine(b, CATCH, []string{"flagCatch"}, []byte{8}, []uint8{0})
|
||||||
b = NewLine(b, CATCH, []string{"one"}, []byte{9}, []uint8{0})
|
b = NewLine(b, CATCH, []string{"one"}, []byte{9}, []uint8{0})
|
||||||
|
rs.RootCode = b
|
||||||
|
|
||||||
|
//b = NewLine(b, RELOAD, []string{"setFlagOne"}, nil, nil)
|
||||||
|
//b = NewLine(b, CATCH, []string{"flagCatch"}, []byte{8}, []uint8{0})
|
||||||
|
|
||||||
ctx := context.TODO()
|
ctx := context.TODO()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user