Skip to content

Commit c206040

Browse files
committed
Fix panic when there is a method with empty receiver.
#428
1 parent 77f5eaf commit c206040

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

decl.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ func new_decl_var(name string, typ ast.Expr, value ast.Expr, vindex int, scope *
340340

341341
func method_of(d ast.Decl) string {
342342
if t, ok := d.(*ast.FuncDecl); ok {
343-
if t.Recv != nil {
343+
if t.Recv != nil && len(t.Recv.List) != 0 {
344344
switch t := t.Recv.List[0].Type.(type) {
345345
case *ast.StarExpr:
346346
if se, ok := t.X.(*ast.SelectorExpr); ok {

0 commit comments

Comments
 (0)