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

Function validateIdentifier

ext/protos.go:142–159  ·  view source on GitHub ↗
(expr ast.Expr)

Source from the content-addressed store, hash-verified

140}
141
142func validateIdentifier(expr ast.Expr) (string, bool) {
143 switch expr.Kind() {
144 case ast.IdentKind:
145 return expr.AsIdent(), true
146 case ast.SelectKind:
147 sel := expr.AsSelect()
148 if sel.IsTestOnly() {
149 return "", false
150 }
151 opStr, isIdent := validateIdentifier(sel.Operand())
152 if !isIdent {
153 return "", false
154 }
155 return opStr + "." + sel.FieldName(), true
156 default:
157 return "", false
158 }
159}

Callers 1

getExtFieldNameFunction · 0.85

Calls 6

KindMethod · 0.65
AsIdentMethod · 0.65
AsSelectMethod · 0.65
IsTestOnlyMethod · 0.65
OperandMethod · 0.65
FieldNameMethod · 0.65

Tested by

no test coverage detected