1
0
mirror of https://github.com/golang/go synced 2024-11-23 20:30:04 -07:00

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 <mdempsky@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
Matthew Dempsky 2016-10-17 16:03:27 -07:00
parent 2a441d3078
commit 2b687a7df8

View 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