MCPcopy Create free account
hub / github.com/despiteallobjections/amigo / makeThunkKey

Method makeThunkKey

types/wrappers.go:292–313  ·  view source on GitHub ↗
(key selectionKey)

Source from the content-addressed store, hash-verified

290}
291
292func (prog *Program) makeThunkKey(key selectionKey) *Function {
293 prog.methodsMu.Lock()
294 defer prog.methodsMu.Unlock()
295
296 // Canonicalize key.recv to avoid constructing duplicate thunks.
297 canonRecv, ok := prog.canon.At(key.recv).(Type)
298 if !ok {
299 canonRecv = key.recv
300 prog.canon.Set(key.recv, canonRecv)
301 }
302 key.recv = canonRecv
303
304 fn, ok := prog.thunks[key]
305 if !ok {
306 fn = prog.makeWrapperKey(key)
307 if fn.Signature.Recv() != nil {
308 panic(fn) // unexpected receiver
309 }
310 prog.thunks[key] = fn
311 }
312 return fn
313}
314
315func changeRecv(s *Signature, recv *Var) *Signature {
316 return NewSignatureType(recv, nil, nil, s.Params(), s.Results(), s.Variadic())

Callers 2

makeThunkMethod · 0.95
expr0Method · 0.80

Calls 4

makeWrapperKeyMethod · 0.95
SetMethod · 0.65
AtMethod · 0.45
RecvMethod · 0.45

Tested by

no test coverage detected