From 2b687a7df854f3c88b266b6cec59a207a45c2353 Mon Sep 17 00:00:00 2001 From: Matthew Dempsky Date: Mon, 17 Oct 2016 16:03:27 -0700 Subject: [PATCH] cmd/compile: stop treating interface methods like actual functions Interface methods can't have function bodies, so there's no need to process their parameter lists as variable declarations. The only possible reason would be to check for duplicate parameter names and/or invalid types, but we do that anyway, and have regression tests for it (test/funcdup.go). Change-Id: Iedb15335467caa5d872dbab829bf32ab8cf6204d Reviewed-on: https://go-review.googlesource.com/31430 Run-TryBot: Matthew Dempsky Reviewed-by: Brad Fitzpatrick TryBot-Result: Gobot Gobot --- src/cmd/compile/internal/gc/dcl.go | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/src/cmd/compile/internal/gc/dcl.go b/src/cmd/compile/internal/gc/dcl.go index d385e76fc9..70f3d3c667 100644 --- a/src/cmd/compile/internal/gc/dcl.go +++ b/src/cmd/compile/internal/gc/dcl.go @@ -506,21 +506,6 @@ func ifacedcl(n *Node) { if isblank(n.Left) { yyerror("methods must have a unique non-blank name") } - - n.Func = new(Func) - n.Func.FCurfn = Curfn - dclcontext = PPARAM - - funcstart(n) - funcargs(n.Right) - - // funcbody is normally called after the parser has - // seen the body of a function but since an interface - // field declaration does not have a body, we must - // call it now to pop the current declaration context. - dclcontext = PAUTO - - funcbody(n) } // declare the function proper