Skip to content

Commit dd1ed05

Browse files
xgopilotvisualfc
andcommitted
cl: use fn.Signature.Params.At(0) for $thunk receiver
Fixed the receiver extraction to use fn.Signature.Params.At(0) instead of treating it the same as functions. This ensures proper function naming and type resolution for thunk methods. Generated with [codeagent](https://github.com/qbox/codeagent) Co-authored-by: visualfc <[email protected]>
1 parent 1fa191c commit dd1ed05

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

cl/import.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -418,9 +418,9 @@ func funcName(pkg *types.Package, fn *ssa.Function, org bool) string {
418418
recv = parent.Signature.Recv()
419419
} else {
420420
recv = fn.Signature.Recv()
421-
// check $bound and $thunk
422-
if recv == nil && (strings.HasSuffix(fn.Name(), "$bound") || strings.HasSuffix(fn.Name(), "$thunk")) && len(fn.FreeVars) == 0 {
423-
// For thunks and bound methods, extract receiver from first parameter
421+
// check $thunk and $bound
422+
if recv == nil && strings.HasSuffix(fn.Name(), "$thunk") {
423+
// For thunks, extract receiver from first parameter
424424
if params := fn.Signature.Params(); params.Len() > 0 {
425425
recv = params.At(0)
426426
}

0 commit comments

Comments
 (0)