From fe93d5c015e8e2c883d2c1e74f2e5ce071256cb5 Mon Sep 17 00:00:00 2001 From: Mel Date: Fri, 20 May 2022 00:01:11 +0200 Subject: Access methods for VM data and stop Array copying --- pkg/lang/vm/value/value.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'pkg/lang/vm/value/value.go') diff --git a/pkg/lang/vm/value/value.go b/pkg/lang/vm/value/value.go index e932ed3..daa17dd 100644 --- a/pkg/lang/vm/value/value.go +++ b/pkg/lang/vm/value/value.go @@ -2,7 +2,7 @@ package value type Value struct { t Type - d any + d Data } func NewInt(x int64) Value { @@ -27,7 +27,7 @@ func NewBool(b bool) Value { func NewArray(arr []Value) Value { t := Type{Kind: ArrayType} - return Value{t: t, d: ArrayData(arr)} + return Value{t: t, d: ArrayData{arr: &arr}} } func NewNull() Value { @@ -47,6 +47,6 @@ func (v Value) Type() Type { return v.t } -func (v Value) Data() any { +func (v Value) Data() Data { return v.d } -- cgit 1.4.1