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

Method evalResult

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

2131
2132// evalResult computes the final result of the fold after all entries have been folded and accumulated.
2133func (f *folder) evalResult() ref.Val {
2134 f.computeResult = true
2135 if f.interrupted {
2136 return types.WrapErr(InterruptError{})
2137 }
2138 res := f.result.Exec(f.frame)
2139 // Convert a mutable list or map to an immutable one if the comprehension has generated a list or
2140 // map as a result.
2141 if !types.IsUnknownOrError(res) && f.mutableValue {
2142 if _, ok := res.(traits.MutableLister); ok {
2143 res = res.(traits.MutableLister).ToImmutableList()
2144 }
2145 if _, ok := res.(traits.MutableMapper); ok {
2146 res = res.(traits.MutableMapper).ToImmutableMap()
2147 }
2148 }
2149 return res
2150}
2151
2152// reset clears any state associated with folder evaluation.
2153func (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