diff --git a/examples/profile/identified b/examples/profile/identified new file mode 100644 index 0000000..86b7f14 --- /dev/null +++ b/examples/profile/identified @@ -0,0 +1,3 @@ +You are identified as: +Name: {{.myname}} +Email: {{.myemail}} diff --git a/examples/profile/identified.vis b/examples/profile/identified.vis new file mode 100644 index 0000000..8a940fe --- /dev/null +++ b/examples/profile/identified.vis @@ -0,0 +1,2 @@ +MAP myname +MAP myemail diff --git a/vm/runner.go b/vm/runner.go index 6eacd3b..7317ea3 100644 --- a/vm/runner.go +++ b/vm/runner.go @@ -191,7 +191,8 @@ func(vm *Vm) RunCatch(b []byte, ctx context.Context) ([]byte, error) { if err != nil { return b, err } - b = append(bh, b...) + //b = append(bh, b...) + b = bh vm.st.Down(sym) vm.ca.Push() vm.Reset() diff --git a/vm/runner_test.go b/vm/runner_test.go index fc18c63..a7d05ba 100644 --- a/vm/runner_test.go +++ b/vm/runner_test.go @@ -18,6 +18,7 @@ var dynVal = "three" type TestResource struct { resource.MenuResource state *state.State + RootCode []byte } 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, HALT, nil, nil, nil) b = NewLine(b, MOVE, []string{"_"}, nil, nil) + case "root": + b = r.RootCode } return b, nil @@ -495,10 +498,13 @@ func TestInputBranch(t *testing.T) { st.Down("root") 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, CATCH, []string{"flagCatch"}, []byte{8}, []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()