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

Method MaybeAttribute

interpreter/attributes.go:203–222  ·  view source on GitHub ↗

MaybeAttribute collects variants of unchecked AbsoluteAttribute values which could either be direct variable accesses or some combination of variable access with qualification.

(id int64, name string)

Source from the content-addressed store, hash-verified

201// MaybeAttribute collects variants of unchecked AbsoluteAttribute values which could either be
202// direct variable accesses or some combination of variable access with qualification.
203func (r *attrFactory) MaybeAttribute(id int64, name string) Attribute {
204 var names []string
205 // When there's a single name with a dot prefix, it indicates that the 'maybe' attribute is a
206 // globally namespaced identifier.
207 if strings.HasPrefix(name, ".") {
208 names = append(names, name)
209 } else {
210 // In all other cases, the candidate names should be inferred.
211 names = r.container.ResolveCandidateNames(name)
212 }
213 return &maybeAttribute{
214 id: id,
215 attrs: []NamespacedAttribute{
216 r.AbsoluteAttribute(id, names...),
217 },
218 adapter: r.adapter,
219 provider: r.provider,
220 fac: r,
221 }
222}
223
224// RelativeAttribute refers to an expression and an optional qualifier path.
225func (r *attrFactory) RelativeAttribute(id int64, operand Interpretable) Attribute {

Callers

nothing calls this directly

Calls 2

AbsoluteAttributeMethod · 0.95
ResolveCandidateNamesMethod · 0.80

Tested by

no test coverage detected