diff --git a/go/engine/engine.go b/go/engine/engine.go index 3c38554..acb23f8 100644 --- a/go/engine/engine.go +++ b/go/engine/engine.go @@ -38,17 +38,6 @@ func(en *Engine) Init(sym string, ctx context.Context) error { if err != nil { return err } -// location := en.st.Where() -// code, err := en.rs.GetCode(location) -// if err != nil { -// return err -// } -// if len(code) == 0 { -// return fmt.Errorf("no code found at resource %s", en.rs) -// } -// -// code, err = vm.Run(code, en.st, en.rs, ctx) -// en.st.SetCode(b) return nil } diff --git a/go/state/state.go b/go/state/state.go index a4fe872..19c81db 100644 --- a/go/state/state.go +++ b/go/state/state.go @@ -238,6 +238,10 @@ func(st *State) Add(key string, value string, sizeLimit uint16) error { } checkFrame := st.frameOf(key) if checkFrame > -1 { + if checkFrame == len(st.execPath) - 1 { + log.Printf("Ignoring load request on frame that has symbol already loaded") + return nil + } return fmt.Errorf("key %v already defined in frame %v", key, checkFrame) } sz := st.checkCapacity(value) diff --git a/go/state/state_test.go b/go/state/state_test.go index 7a8e7fa..7ed746d 100644 --- a/go/state/state_test.go +++ b/go/state/state_test.go @@ -227,6 +227,11 @@ func TestStateLoadDup(t *testing.T) { if err == nil { t.Errorf("expected fail on duplicate load") } + st.Up() + err = st.Add("foo", "xyzzy", 0) + if err != nil { + t.Error(err) + } } func TestStateCurrentSize(t *testing.T) {