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

Method ResolveCandidateNames

common/containers/container.go:111–134  ·  view source on GitHub ↗

ResolveCandidateNames returns the candidates name of namespaced identifiers in C++ resolution order. Names which shadow other names are returned first. If a name includes a leading dot ('.'), the name is treated as an absolute identifier which cannot be shadowed. Given a container name a.b.c.M.N a

(name string)

Source from the content-addressed store, hash-verified

109// If aliases or abbreviations are configured for the container, then alias names will take
110// precedence over containerized names.
111func (c *Container) ResolveCandidateNames(name string) []string {
112 if strings.HasPrefix(name, ".") {
113 qn := name[1:]
114 alias, isAlias := c.findAlias(qn)
115 if isAlias {
116 return []string{alias}
117 }
118 return []string{qn}
119 }
120 alias, isAlias := c.findAlias(name)
121 if isAlias {
122 return []string{alias}
123 }
124 if c.Name() == "" {
125 return []string{name}
126 }
127 nextCont := c.Name()
128 candidates := []string{nextCont + "." + name}
129 for i := strings.LastIndex(nextCont, "."); i >= 0; i = strings.LastIndex(nextCont, ".") {
130 nextCont = nextCont[:i]
131 candidates = append(candidates, nextCont+"."+name)
132 }
133 return append(candidates, name)
134}
135
136// AliasSet returns the alias to fully-qualified name mapping stored in the container.
137func (c *Container) AliasSet() map[string]string {

Implementers 7

baseMapcommon/types/map.go
protoMapcommon/types/map.go
proxyLegacyMapcommon/types/map_test.go
proxyLegacyListcommon/types/list_test.go
Unknowncommon/types/unknown.go
baseListcommon/types/list.go
concatListcommon/types/list.go

Calls 2

findAliasMethod · 0.95
NameMethod · 0.95