linked-list supports index assign and concatenation

This commit is contained in:
2026-07-13 11:34:25 +02:00
parent 072fd9af39
commit 4df222496d
7 changed files with 52 additions and 29 deletions
+7
View File
@@ -9,6 +9,7 @@ import (
"git.portale-stac.it/go-pkg/expr/scan"
"git.portale-stac.it/go-pkg/expr/types/array"
"git.portale-stac.it/go-pkg/expr/types/dict"
"git.portale-stac.it/go-pkg/expr/types/list"
"git.portale-stac.it/go-pkg/expr/util"
)
@@ -73,6 +74,12 @@ func assignCollectionItem(ctx kern.ExprContext, collectionTerm, keyListTerm *sca
}
case *dict.DictType:
collection.SetItem(keyValue, value)
case *list.LinkedList:
if index, ok := keyValue.(int64); ok {
err = collection.SetItem(index, value)
} else {
err = keyListTerm.Errorf("integer expected, got %v [%s]", keyValue, kern.TypeName(keyValue))
}
default:
err = collectionTerm.Errorf("collection expected")
}