operator-include.go: Fixed inclusion of a list of files.
Now returns the value of the last evaluated expression.
This commit is contained in:
parent
905337f963
commit
f3cc0cc7ad
@ -25,8 +25,8 @@ func evalInclude(ctx ExprContext, opTerm *term) (v any, err error) {
|
||||
|
||||
count := 0
|
||||
if IsList(childValue) {
|
||||
list, _ := childValue.([]any)
|
||||
for i, filePathSpec := range list {
|
||||
list, _ := childValue.(*ListType)
|
||||
for i, filePathSpec := range *list {
|
||||
if filePath, ok := filePathSpec.(string); ok {
|
||||
if v, err = EvalFile(ctx, filePath); err == nil {
|
||||
count++
|
||||
@ -47,8 +47,9 @@ func evalInclude(ctx ExprContext, opTerm *term) (v any, err error) {
|
||||
} else {
|
||||
err = opTerm.errIncompatibleType(childValue)
|
||||
}
|
||||
if err == nil {
|
||||
v = count
|
||||
if err != nil {
|
||||
//v = count
|
||||
v = nil
|
||||
}
|
||||
return
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user