Commit 2b687a7d authored by Matthew Dempsky's avatar Matthew Dempsky

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: default avatarBrad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent 2a441d30
...@@ -506,21 +506,6 @@ func ifacedcl(n *Node) { ...@@ -506,21 +506,6 @@ func ifacedcl(n *Node) {
if isblank(n.Left) { if isblank(n.Left) {
yyerror("methods must have a unique non-blank name") 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 // declare the function proper
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment