adapted and enhanced the dict operations to make them compatible with the new DictType

This commit is contained in:
2024-05-19 01:38:07 +02:00
parent d6a1607041
commit 24a25bbf94
6 changed files with 111 additions and 20 deletions
+2 -2
View File
@@ -59,11 +59,11 @@ func evalDot(ctx ExprContext, self *term) (v any, err error) {
if index, err = verifyIndex(ctx, indexTerm, len(unboxedValue)); err == nil {
v = string(unboxedValue[index])
}
case map[any]any:
case *DictType:
var ok bool
var indexValue any
if indexValue, err = indexTerm.compute(ctx); err == nil {
if v, ok = unboxedValue[indexValue]; !ok {
if v, ok = (*unboxedValue)[indexValue]; !ok {
err = fmt.Errorf("key %v does not belong to the dictionary", rightValue)
}
}