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

Function celBind

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

Source from the content-addressed store, hash-verified

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