refactored data-types to reduce plugin sizes
This commit is contained in:
+9
-6
@@ -10,6 +10,9 @@ import (
|
||||
|
||||
"git.portale-stac.it/go-pkg/expr/kern"
|
||||
"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"
|
||||
)
|
||||
|
||||
// -------- iterator term
|
||||
@@ -52,7 +55,7 @@ func evalFirstChild(ctx kern.ExprContext, iteratorTerm *scan.Term) (value any, e
|
||||
}
|
||||
|
||||
func getDataSourceDict(iteratorTerm *scan.Term, firstChildValue any) (ds map[string]kern.Functor, err error) {
|
||||
if dictAny, ok := firstChildValue.(*kern.DictType); ok {
|
||||
if dictAny, ok := firstChildValue.(*dict.DictType); ok {
|
||||
requiredFields := []string{kern.NextName}
|
||||
fieldsMask := 0b1
|
||||
foundFields := 0
|
||||
@@ -123,7 +126,7 @@ func evalIterator(ctx kern.ExprContext, opTerm *scan.Term) (v any, err error) {
|
||||
|
||||
v = dc
|
||||
} else {
|
||||
if dictIt, ok := firstChildValue.(*kern.DictType); ok {
|
||||
if dictIt, ok := firstChildValue.(*dict.DictType); ok {
|
||||
var args []any
|
||||
if args, err = evalSiblings(ctx, opTerm.Children, nil); err == nil {
|
||||
v, err = NewDictIterator(dictIt, args)
|
||||
@@ -132,15 +135,15 @@ func evalIterator(ctx kern.ExprContext, opTerm *scan.Term) (v any, err error) {
|
||||
err = opTerm.Children[0].Errorf("the data-source must be a dictionary")
|
||||
}
|
||||
}
|
||||
} else if list, ok := firstChildValue.(*kern.ListType); ok {
|
||||
} else if a, ok := firstChildValue.(*array.ListType); ok {
|
||||
var args []any
|
||||
if args, err = evalSiblings(ctx, opTerm.Children, nil); err == nil {
|
||||
v = NewListIterator(list, args)
|
||||
v = NewListIterator(a, args)
|
||||
}
|
||||
} else if list, ok := firstChildValue.(*kern.LinkedList); ok {
|
||||
} else if ll, ok := firstChildValue.(*list.LinkedList); ok {
|
||||
var args []any
|
||||
if args, err = evalSiblings(ctx, opTerm.Children, nil); err == nil {
|
||||
v = NewLinkedListIterator(list, args)
|
||||
v = NewLinkedListIterator(ll, args)
|
||||
}
|
||||
} else if intVal, ok := firstChildValue.(int64); ok {
|
||||
var args []any
|
||||
|
||||
Reference in New Issue
Block a user