MCPcopy Create free account
hub / github.com/cel-expr/cel-go / evalResult

Method evalResult

interpreter/interpretable.go:1626–1643  ·  view source on GitHub ↗

evalResult computes the final result of the fold after all entries have been folded and accumulated.

()

Source from the content-addressed store, hash-verified

1624
1625// evalResult computes the final result of the fold after all entries have been folded and accumulated.
1626func (f *folder) evalResult() ref.Val {
1627 f.computeResult = true
1628 if f.interrupted {
1629 return types.WrapErr(InterruptError{})
1630 }
1631 res := f.result.Exec(f.frame)
1632 // Convert a mutable list or map to an immutable one if the comprehension has generated a list or
1633 // map as a result.
1634 if !types.IsUnknownOrError(res) && f.mutableValue {
1635 if _, ok := res.(traits.MutableLister); ok {
1636 res = res.(traits.MutableLister).ToImmutableList()
1637 }
1638 if _, ok := res.(traits.MutableMapper); ok {
1639 res = res.(traits.MutableMapper).ToImmutableMap()
1640 }
1641 }
1642 return res
1643}
1644
1645// reset clears any state associated with folder evaluation.
1646func (f *folder) reset() {

Callers 2

foldIterableMethod · 0.95
ExecMethod · 0.80

Calls 5

WrapErrFunction · 0.92
IsUnknownOrErrorFunction · 0.92
ExecMethod · 0.65
ToImmutableListMethod · 0.65
ToImmutableMapMethod · 0.65

Tested by

no test coverage detected