MCPcopy
hub / github.com/gopherjs/gopherjs / Resolve

Method Resolve

compiler/internal/typeparams/instance.go:124–134  ·  view source on GitHub ↗

Resolve instantiates and performs a substitution of the instance to get the concrete type or function. This will panic if the instance is not valid, e.g. if there are a different number of type arguments than the type parameters. If `tc` is non-nil, it de-duplicates the instance against previous in

(tc *types.Context)

Source from the content-addressed store, hash-verified

122// When resolving several instances in the same context, it is more efficient
123// to use NewResolver to take advantage of caching.
124func (i Instance) Resolve(tc *types.Context) types.Type {
125 instType := i.Object.Type()
126 if len(i.TArgs) > 0 {
127 var err error
128 instType, err = types.Instantiate(tc, instType, i.TArgs, true)
129 if err != nil {
130 panic(fmt.Errorf("failed to instantiate %v: %w", i, err))
131 }
132 }
133 return NewResolver(tc, i).Substitute(instType)
134}
135
136// InstanceSet allows collecting and processing unique Instances.
137//

Calls 3

NewResolverFunction · 0.85
SubstituteMethod · 0.80
TypeMethod · 0.65