operator-assign.go: some errors message changed to report the Expr's type names, not the Go ones
This commit is contained in:
parent
4e3af837e6
commit
e4ded4f746
@ -32,7 +32,7 @@ func assignCollectionItem(ctx ExprContext, collectionTerm, keyListTerm *term, va
|
||||
if keyListValue, err = keyListTerm.compute(ctx); err != nil {
|
||||
return
|
||||
} else if keyList, ok = keyListValue.(*ListType); !ok || len(*keyList) != 1 {
|
||||
err = keyListTerm.Errorf("index/key specification expected, got %v [%T]", keyListValue, keyListValue)
|
||||
err = keyListTerm.Errorf("index/key specification expected, got %v [%s]", keyListValue, typeName(keyListValue))
|
||||
return
|
||||
}
|
||||
keyValue = (*keyList)[0]
|
||||
@ -42,7 +42,7 @@ func assignCollectionItem(ctx ExprContext, collectionTerm, keyListTerm *term, va
|
||||
if index, ok := keyValue.(int64); ok {
|
||||
err = assignListItem(collection, index, value)
|
||||
} else {
|
||||
err = keyListTerm.Errorf("integer expected, got %v [%T]", keyValue, keyValue)
|
||||
err = keyListTerm.Errorf("integer expected, got %v [%s]", keyValue, typeName(keyValue))
|
||||
}
|
||||
case *DictType:
|
||||
collection.setItem(keyValue, value)
|
||||
@ -174,6 +174,9 @@ func evalAssign(ctx ExprContext, self *term) (v any, err error) {
|
||||
//ctx.UnsafeSetVar(leftTerm.source(), v)
|
||||
}
|
||||
}
|
||||
if err != nil {
|
||||
v=nil
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user