operator-insert.go: replaced []any with ListType
This commit is contained in:
parent
c977e82d9e
commit
510966c497
@ -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)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user