about summary refs log tree commit diff
path: root/pkg
diff options
context:
space:
mode:
authorMel <einebeere@gmail.com>2022-08-29 23:50:06 +0000
committerMel <einebeere@gmail.com>2022-08-29 23:50:06 +0000
commitafb8ae0018a5947d5e33c9f59d31c5009028e79d (patch)
treedbb891320a363ae81696129c2983d0f35a86a2ae /pkg
parent1afe662ccd02d686f46f596242055c3ea23e645f (diff)
downloadjinx-afb8ae0018a5947d5e33c9f59d31c5009028e79d.tar.zst
jinx-afb8ae0018a5947d5e33c9f59d31c5009028e79d.zip
Clone element when pushing to array
Diffstat (limited to 'pkg')
-rw-r--r--pkg/lang/modules/core/natives.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/pkg/lang/modules/core/natives.go b/pkg/lang/modules/core/natives.go
index 8a24663..7fc9a01 100644
--- a/pkg/lang/modules/core/natives.go
+++ b/pkg/lang/modules/core/natives.go
@@ -90,6 +90,11 @@ var Natives = []any{
 		}
 
 		element := args[1]
+		element, err = element.Clone(exe.Mem())
+		if err != nil {
+			return value.Value{}, err
+		}
+
 		return value.Value{}, array.Push(exe.Mem(), element)
 	}),
 	n(":core:Array:pop", 1, func(exe executor.Exectutor, args []value.Value) (value.Value, error) {