self param replaced as opTerm
This commit is contained in:
+7
-7
@@ -95,15 +95,15 @@ func getDataSourceDict(iteratorTerm *term, firstChildValue any) (ds map[string]F
|
||||
return
|
||||
}
|
||||
|
||||
func evalIterator(ctx ExprContext, iteratorTerm *term) (v any, err error) {
|
||||
func evalIterator(ctx ExprContext, opTerm *term) (v any, err error) {
|
||||
var firstChildValue any
|
||||
var ds map[string]Functor
|
||||
|
||||
if firstChildValue, err = evalFirstChild(ctx, iteratorTerm); err != nil {
|
||||
if firstChildValue, err = evalFirstChild(ctx, opTerm); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if ds, err = getDataSourceDict(iteratorTerm, firstChildValue); err != nil {
|
||||
if ds, err = getDataSourceDict(opTerm, firstChildValue); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -111,8 +111,8 @@ func evalIterator(ctx ExprContext, iteratorTerm *term) (v any, err error) {
|
||||
dc := newDataCursor(ctx, ds)
|
||||
if initFunc, exists := ds[initName]; exists && initFunc != nil {
|
||||
var args []any
|
||||
if len(iteratorTerm.children) > 1 {
|
||||
if args, err = evalTermArray(ctx, iteratorTerm.children[1:]); err != nil {
|
||||
if len(opTerm.children) > 1 {
|
||||
if args, err = evalTermArray(ctx, opTerm.children[1:]); err != nil {
|
||||
return
|
||||
}
|
||||
} else {
|
||||
@@ -134,12 +134,12 @@ func evalIterator(ctx ExprContext, iteratorTerm *term) (v any, err error) {
|
||||
v = dc
|
||||
} else if list, ok := firstChildValue.(*ListType); ok {
|
||||
var args []any
|
||||
if args, err = evalSibling(ctx, iteratorTerm.children, nil); err == nil {
|
||||
if args, err = evalSibling(ctx, opTerm.children, nil); err == nil {
|
||||
v = NewListIterator(list, args)
|
||||
}
|
||||
} else {
|
||||
var list []any
|
||||
if list, err = evalSibling(ctx, iteratorTerm.children, firstChildValue); err == nil {
|
||||
if list, err = evalSibling(ctx, opTerm.children, firstChildValue); err == nil {
|
||||
v = NewArrayIterator(list)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user