Commit 02370f67 authored by Andrew Wilkins's avatar Andrew Wilkins Committed by Robert Griesemer

go/types: Set Signature.Recv for imported types

R=golang-dev, bradfitz, gri
CC=golang-dev
https://golang.org/cl/7065046
parent 20e97607
...@@ -766,9 +766,10 @@ func (p *gcParser) parseVarDecl() { ...@@ -766,9 +766,10 @@ func (p *gcParser) parseVarDecl() {
// Func = Signature [ Body ] . // Func = Signature [ Body ] .
// Body = "{" ... "}" . // Body = "{" ... "}" .
// //
func (p *gcParser) parseFunc(scope *ast.Scope, name string) { func (p *gcParser) parseFunc(scope *ast.Scope, name string) *Signature {
obj := p.declare(scope, ast.Fun, name) obj := p.declare(scope, ast.Fun, name)
obj.Type = p.parseSignature() sig := p.parseSignature()
obj.Type = sig
if p.tok == '{' { if p.tok == '{' {
p.next() p.next()
for i := 1; i > 0; p.next() { for i := 1; i > 0; p.next() {
...@@ -780,6 +781,7 @@ func (p *gcParser) parseFunc(scope *ast.Scope, name string) { ...@@ -780,6 +781,7 @@ func (p *gcParser) parseFunc(scope *ast.Scope, name string) {
} }
} }
} }
return sig
} }
// MethodDecl = "func" Receiver Name Func . // MethodDecl = "func" Receiver Name Func .
...@@ -809,7 +811,8 @@ func (p *gcParser) parseMethodDecl() { ...@@ -809,7 +811,8 @@ func (p *gcParser) parseMethodDecl() {
// declare method in base type scope // declare method in base type scope
name := p.parseName() // unexported method names in imports are qualified with their package. name := p.parseName() // unexported method names in imports are qualified with their package.
p.parseFunc(scope, name) sig := p.parseFunc(scope, name)
sig.Recv = recv
} }
// FuncDecl = "func" ExportedName Func . // FuncDecl = "func" ExportedName Func .
......
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