]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: stop treating interface methods like actual functions
authorMatthew Dempsky <mdempsky@google.com>
Mon, 17 Oct 2016 23:03:27 +0000 (16:03 -0700)
committerMatthew Dempsky <mdempsky@google.com>
Tue, 18 Oct 2016 17:29:52 +0000 (17:29 +0000)
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 <mdempsky@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/cmd/compile/internal/gc/dcl.go

index d385e76fc9dde63dd04cfddc9a227d00d700f19b..70f3d3c6679f035d9acfab6684c87308b8aa9617 100644 (file)
@@ -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