about summary refs log tree commit diff
path: root/pkg/lang/vm/value/data.go
diff options
context:
space:
mode:
authorMel <einebeere@gmail.com>2022-08-10 23:05:35 +0000
committerMel <einebeere@gmail.com>2022-08-10 23:05:35 +0000
commitc46b2bc7ce6df1f2c6c9494ef08015ec29992da5 (patch)
tree49cac24a33e85907878248aac973e967765bf79d /pkg/lang/vm/value/data.go
parent42e78f469ca71360943f95c54080c89d39346cd7 (diff)
downloadjinx-c46b2bc7ce6df1f2c6c9494ef08015ec29992da5.tar.zst
jinx-c46b2bc7ce6df1f2c6c9494ef08015ec29992da5.zip
Use TypeKind instead of Ptr to deduce Value types
Diffstat (limited to 'pkg/lang/vm/value/data.go')
-rw-r--r--pkg/lang/vm/value/data.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/pkg/lang/vm/value/data.go b/pkg/lang/vm/value/data.go
index 6ec7be9..39193d5 100644
--- a/pkg/lang/vm/value/data.go
+++ b/pkg/lang/vm/value/data.go
@@ -207,6 +207,7 @@ func (t TypeRefData) AddMethod(m mem.Mem, name string, method FunctionData) erro
 }
 
 type ObjectData struct {
+	t   mem.Ptr
 	obj mem.Ptr
 }
 
@@ -217,3 +218,11 @@ func (o ObjectData) String(_ mem.Mem) (string, error) {
 func (o ObjectData) Ptr() mem.Ptr {
 	return o.obj
 }
+
+func (o ObjectData) Type() mem.Ptr {
+	return o.t
+}
+
+func (o ObjectData) WithType(t mem.Ptr) ObjectData {
+	return ObjectData{t: t, obj: o.obj}
+}