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

Function exprComprehension

common/ast/conversion.go:170–200  ·  view source on GitHub ↗
(factory ExprFactory, id int64, comp *exprpb.Expr_Comprehension)

Source from the content-addressed store, hash-verified

168}
169
170func exprComprehension(factory ExprFactory, id int64, comp *exprpb.Expr_Comprehension) (Expr, error) {
171 iterRange, err := exprInternal(factory, comp.GetIterRange())
172 if err != nil {
173 return nil, err
174 }
175 accuInit, err := exprInternal(factory, comp.GetAccuInit())
176 if err != nil {
177 return nil, err
178 }
179 loopCond, err := exprInternal(factory, comp.GetLoopCondition())
180 if err != nil {
181 return nil, err
182 }
183 loopStep, err := exprInternal(factory, comp.GetLoopStep())
184 if err != nil {
185 return nil, err
186 }
187 result, err := exprInternal(factory, comp.GetResult())
188 if err != nil {
189 return nil, err
190 }
191 return factory.NewComprehensionTwoVar(id,
192 iterRange,
193 comp.GetIterVar(),
194 comp.GetIterVar2(),
195 comp.GetAccuVar(),
196 accuInit,
197 loopCond,
198 loopStep,
199 result), nil
200}
201
202func exprLiteral(factory ExprFactory, id int64, c *exprpb.Constant) (Expr, error) {
203 val, err := ConstantToVal(c)

Callers 1

exprInternalFunction · 0.85

Calls 2

exprInternalFunction · 0.85

Tested by

no test coverage detected