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

Function celBind

ext/bindings.go:171–194  ·  view source on GitHub ↗
(mef cel.MacroExprFactory, target ast.Expr, args []ast.Expr)

Source from the content-addressed store, hash-verified

169}
170
171func celBind(mef cel.MacroExprFactory, target ast.Expr, args []ast.Expr) (ast.Expr, *cel.Error) {
172 if !macroTargetMatchesNamespace(celNamespace, target) {
173 return nil, nil
174 }
175 varIdent := args[0]
176 varName := ""
177 switch varIdent.Kind() {
178 case ast.IdentKind:
179 varName = varIdent.AsIdent()
180 default:
181 return nil, mef.NewError(varIdent.ID(), "cel.bind() variable names must be simple identifiers")
182 }
183 varInit := args[1]
184 resultExpr := args[2]
185 return mef.NewComprehension(
186 mef.NewList(),
187 unusedIterVar,
188 varName,
189 varInit,
190 mef.NewLiteral(types.False),
191 mef.NewIdent(varName),
192 resultExpr,
193 ), nil
194}
195
196func newDynamicBlock(slotExprs []interpreter.InterpretableV2, expr interpreter.InterpretableV2) interpreter.InterpretableV2 {
197 bs := &dynamicBlock{

Callers

nothing calls this directly

Calls 9

KindMethod · 0.65
AsIdentMethod · 0.65
NewErrorMethod · 0.65
IDMethod · 0.65
NewComprehensionMethod · 0.65
NewListMethod · 0.65
NewLiteralMethod · 0.65
NewIdentMethod · 0.65

Tested by

no test coverage detected