operator-insert.go: replaced []any with ListType

This commit is contained in:
Celestino Amoroso 2024-05-06 04:43:29 +02:00
parent c977e82d9e
commit 510966c497

View File

@ -34,8 +34,9 @@ func evalInsert(ctx ExprContext, self *term) (v any, err error) {
}
if isList(rightValue) {
list, _ := rightValue.([]any)
v = append([]any{leftValue}, list...)
list, _ := rightValue.(*ListType)
newList := append(ListType{leftValue}, *list...)
v = &newList
} else {
err = self.errIncompatibleTypes(leftValue, rightValue)
}
@ -50,8 +51,9 @@ func evalAppend(ctx ExprContext, self *term) (v any, err error) {
}
if isList(leftValue) {
list, _ := leftValue.([]any)
v = append(list, rightValue)
list, _ := leftValue.(*ListType)
newList := append(*list, rightValue)
v = &newList
} else {
err = self.errIncompatibleTypes(leftValue, rightValue)
}