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

Method computeQualifiers

checker/checker.go:165–185  ·  view source on GitHub ↗

computeQualifiers computes the qualified names parts of a select expression.

(e ast.Expr)

Source from the content-addressed store, hash-verified

163
164// computeQualifiers computes the qualified names parts of a select expression.
165func (c *checker) computeQualifiers(e ast.Expr) ([]string, bool) {
166 var qualifiers []string
167 for e.Kind() == ast.SelectKind {
168 sel := e.AsSelect()
169 // test only expressions are not considered for qualified name selection.
170 if sel.IsTestOnly() {
171 return qualifiers, false
172 }
173 // otherwise append the select field name to the qualifier list (reverse order)
174 qualifiers = append(qualifiers, sel.FieldName())
175 e = sel.Operand()
176 // If the next operand is an identifier, then append it, reverse the name sequence
177 // and return it to the caller.s
178 if e.Kind() == ast.IdentKind {
179 qualifiers = append(qualifiers, e.AsIdent())
180 slices.Reverse(qualifiers)
181 return qualifiers, true
182 }
183 }
184 return qualifiers, false
185}
186
187func (c *checker) checkOptSelect(e ast.Expr) {
188 // Collect metadata related to the opt select call packaged by the parser.

Callers 1

checkSelectMethod · 0.95

Calls 6

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

Tested by

no test coverage detected