MCPcopy Create free account
hub / github.com/brimdata/super / getVariant

Method getVariant

compiler/semantic/resolver.go:185–204  ·  view source on GitHub ↗
(id string, params []string, lambdas []lambda, inType super.Type)

Source from the content-addressed store, hash-verified

183}
184
185func (r *resolver) getVariant(id string, params []string, lambdas []lambda, inType super.Type) *funcDef {
186 if variant := r.lookupVariant(id, lambdas); variant != nil {
187 return variant
188 }
189 d := r.decls[id]
190 tag := r.nextTag()
191 variant := &funcDef{
192 tag: tag,
193 name: d.name,
194 params: params,
195 lambdas: lambdas,
196 // body needs to be resolved
197 }
198 r.funcs[tag] = variant
199 // We put the variant in the decl before resolving the body to stop recursion.
200 d.variants = append(d.variants, variant)
201 // Resolve the body here.
202 r.resolveVariant(d, variant, inType)
203 return variant
204}
205
206func matchVariant(def *funcDef, lambdas []lambda) bool {
207 // find match or detect change and error or false/nil

Callers 1

mustResolveCallMethod · 0.95

Calls 3

lookupVariantMethod · 0.95
nextTagMethod · 0.95
resolveVariantMethod · 0.95

Tested by

no test coverage detected