digest operator assigns the special variable 'last' for each iteration
This commit is contained in:
+2
-1
@@ -48,9 +48,10 @@ func evalDigest(ctx kern.ExprContext, opTerm *scan.Term) (v any, err error) {
|
|||||||
ctx.SetVar("#", it.Count())
|
ctx.SetVar("#", it.Count())
|
||||||
if rightValue, err = opTerm.Children[1].Compute(ctx); err == nil {
|
if rightValue, err = opTerm.Children[1].Compute(ctx); err == nil {
|
||||||
if rightValue == nil {
|
if rightValue == nil {
|
||||||
break
|
err = io.EOF
|
||||||
} else {
|
} else {
|
||||||
lastValue = rightValue
|
lastValue = rightValue
|
||||||
|
ctx.SetVar(kern.ControlLastResult, lastValue)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ctx.DeleteVar("#")
|
ctx.DeleteVar("#")
|
||||||
|
|||||||
Reference in New Issue
Block a user