operator-sum.go: replaced for-loop with append()
This commit is contained in:
parent
7f367cfc49
commit
9bc8e8ca05
@ -44,12 +44,8 @@ func evalPlus(ctx ExprContext, self *term) (v any, err error) {
|
|||||||
rightList, _ = rightValue.(*ListType)
|
rightList, _ = rightValue.(*ListType)
|
||||||
|
|
||||||
sumList := make(ListType, 0, len(*leftList)+len(*rightList))
|
sumList := make(ListType, 0, len(*leftList)+len(*rightList))
|
||||||
for _, item := range *leftList {
|
sumList = append(sumList, *leftList...)
|
||||||
sumList = append(sumList, item)
|
sumList = append(sumList, *rightList...)
|
||||||
}
|
|
||||||
for _, item := range *rightList {
|
|
||||||
sumList = append(sumList, item)
|
|
||||||
}
|
|
||||||
v = &sumList
|
v = &sumList
|
||||||
} else if (isFraction(leftValue) && IsNumber(rightValue)) || (isFraction(rightValue) && IsNumber(leftValue)) {
|
} else if (isFraction(leftValue) && IsNumber(rightValue)) || (isFraction(rightValue) && IsNumber(leftValue)) {
|
||||||
if IsFloat(leftValue) || IsFloat(rightValue) {
|
if IsFloat(leftValue) || IsFloat(rightValue) {
|
||||||
|
Loading…
Reference in New Issue
Block a user