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

Function maybeAsVariableName

cel/inlining.go:269–283  ·  view source on GitHub ↗
(e ast.NavigableExpr)

Source from the content-addressed store, hash-verified

267}
268
269func maybeAsVariableName(e ast.NavigableExpr) (string, bool) {
270 if e.Kind() == ast.IdentKind {
271 return e.AsIdent(), true
272 }
273 if e.Kind() == ast.SelectKind {
274 sel := e.AsSelect()
275 // While the `ToQualifiedName` call could take the select directly, this
276 // would skip presence tests from possible matches, which we would like
277 // to include.
278 if qualName, found := containers.ToQualifiedName(sel.Operand()); found {
279 return qualName + "." + sel.FieldName(), true
280 }
281 }
282 return "", false
283}

Callers 1

matchVariableMethod · 0.85

Calls 6

ToQualifiedNameFunction · 0.92
KindMethod · 0.65
AsIdentMethod · 0.65
AsSelectMethod · 0.65
OperandMethod · 0.65
FieldNameMethod · 0.65

Tested by

no test coverage detected