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

Method evalResult

interpreter/interpretable.go:1688–1705  ·  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

1686
1687// evalResult computes the final result of the fold after all entries have been folded and accumulated.
1688func (f *folder) evalResult() ref.Val {
1689 f.computeResult = true
1690 if f.interrupted {
1691 return types.WrapErr(InterruptError{})
1692 }
1693 res := f.result.Exec(f.frame)
1694 // Convert a mutable list or map to an immutable one if the comprehension has generated a list or
1695 // map as a result.
1696 if !types.IsUnknownOrError(res) && f.mutableValue {
1697 if _, ok := res.(traits.MutableLister); ok {
1698 res = res.(traits.MutableLister).ToImmutableList()
1699 }
1700 if _, ok := res.(traits.MutableMapper); ok {
1701 res = res.(traits.MutableMapper).ToImmutableMap()
1702 }
1703 }
1704 return res
1705}
1706
1707// reset clears any state associated with folder evaluation.
1708func (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