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) {
|
if isList(rightValue) {
|
||||||
list, _ := rightValue.([]any)
|
list, _ := rightValue.(*ListType)
|
||||||
v = append([]any{leftValue}, list...)
|
newList := append(ListType{leftValue}, *list...)
|
||||||
|
v = &newList
|
||||||
} else {
|
} else {
|
||||||
err = self.errIncompatibleTypes(leftValue, rightValue)
|
err = self.errIncompatibleTypes(leftValue, rightValue)
|
||||||
}
|
}
|
||||||
@ -50,8 +51,9 @@ func evalAppend(ctx ExprContext, self *term) (v any, err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if isList(leftValue) {
|
if isList(leftValue) {
|
||||||
list, _ := leftValue.([]any)
|
list, _ := leftValue.(*ListType)
|
||||||
v = append(list, rightValue)
|
newList := append(*list, rightValue)
|
||||||
|
v = &newList
|
||||||
} else {
|
} else {
|
||||||
err = self.errIncompatibleTypes(leftValue, rightValue)
|
err = self.errIncompatibleTypes(leftValue, rightValue)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user