diff options
| author | Mel <einebeere@gmail.com> | 2022-08-10 23:05:35 +0000 |
|---|---|---|
| committer | Mel <einebeere@gmail.com> | 2022-08-10 23:05:35 +0000 |
| commit | c46b2bc7ce6df1f2c6c9494ef08015ec29992da5 (patch) | |
| tree | 49cac24a33e85907878248aac973e967765bf79d /pkg/lang/vm/exec.go | |
| parent | 42e78f469ca71360943f95c54080c89d39346cd7 (diff) | |
| download | jinx-c46b2bc7ce6df1f2c6c9494ef08015ec29992da5.tar.zst jinx-c46b2bc7ce6df1f2c6c9494ef08015ec29992da5.zip | |
Use TypeKind instead of Ptr to deduce Value types
Diffstat (limited to 'pkg/lang/vm/exec.go')
| -rw-r--r-- | pkg/lang/vm/exec.go | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/pkg/lang/vm/exec.go b/pkg/lang/vm/exec.go index 353d8ac..eeb8710 100644 --- a/pkg/lang/vm/exec.go +++ b/pkg/lang/vm/exec.go @@ -490,14 +490,16 @@ func (vm *VM) execAnchorType() error { } } - if !o.TypePtr().IsNull() { + obj := o.Data().(value.ObjectData) + typeRef := t.Data().(value.TypeRefData) + + if obj.Type() != mem.NullPtr { return ErrCantReanchorType{ Type: o.Type(), } } - o = o.WithType(t.Data().(value.TypeRefData).TypeRef()) - + o = o.WithData(obj.WithType(typeRef.TypeRef())) vm.stack.Push(o) return nil } |
