operator-dot.go: replaced []any with *ListType

This commit is contained in:
Celestino Amoroso 2024-05-06 04:15:46 +02:00
parent 434ddee733
commit f55a48aa26

View File

@ -47,10 +47,11 @@ func evalDot(ctx ExprContext, self *term) (v any, err error) {
indexTerm := self.children[1] indexTerm := self.children[1]
switch unboxedValue := leftValue.(type) { switch unboxedValue := leftValue.(type) {
case []any: case *ListType:
var index int var index int
if index, err = verifyIndex(ctx, indexTerm, len(unboxedValue)); err == nil { array := ([]any)(*unboxedValue)
v = unboxedValue[index] if index, err = verifyIndex(ctx, indexTerm, len(array)); err == nil {
v = array[index]
} }
case string: case string:
var index int var index int