fix different receiver names

This commit is contained in:
bnovil 2024-03-28 14:20:33 +08:00
parent c7c68abcbe
commit 676ec9d10c

View file

@ -678,10 +678,10 @@ func (mo *memoryObj) Length() int {
} }
func (mo *memoryObj) setupObject() *goja.Object { func (mo *memoryObj) setupObject() *goja.Object {
o := m.vm.NewObject() o := mo.vm.NewObject()
o.Set("slice", m.vm.ToValue(m.Slice)) o.Set("slice", mo.vm.ToValue(mo.Slice))
o.Set("getUint", m.vm.ToValue(m.GetUint)) o.Set("getUint", mo.vm.ToValue(mo.GetUint))
o.Set("length", m.vm.ToValue(m.Length)) o.Set("length", mo.vm.ToValue(mo.Length))
return o return o
} }
@ -864,11 +864,11 @@ func (co *contractObj) GetInput() goja.Value {
} }
func (co *contractObj) setupObject() *goja.Object { func (co *contractObj) setupObject() *goja.Object {
o := c.vm.NewObject() o := co.vm.NewObject()
o.Set("getCaller", c.vm.ToValue(c.GetCaller)) o.Set("getCaller", co.vm.ToValue(co.GetCaller))
o.Set("getAddress", c.vm.ToValue(c.GetAddress)) o.Set("getAddress", co.vm.ToValue(co.GetAddress))
o.Set("getValue", c.vm.ToValue(c.GetValue)) o.Set("getValue", co.vm.ToValue(co.GetValue))
o.Set("getInput", c.vm.ToValue(c.GetInput)) o.Set("getInput", co.vm.ToValue(co.GetInput))
return o return o
} }