go.tools/go/types: set correct Method recv type in NewMethodSet
R=adonovan CC=golang-dev https://golang.org/cl/11602043
This commit is contained in:
parent
35f4fd1cd1
commit
f4540b7193
|
|
@ -114,9 +114,9 @@ func (c *cachedMethodSet) of(typ Type) *MethodSet {
|
||||||
return mset
|
return mset
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewMethodSet computes the method set for the given type.
|
// NewMethodSet computes the method set for the given type T.
|
||||||
// It always returns a non-nil method set, even if it is empty.
|
// It always returns a non-nil method set, even if it is empty.
|
||||||
func NewMethodSet(typ Type) *MethodSet {
|
func NewMethodSet(T Type) *MethodSet {
|
||||||
// WARNING: The code in this function is extremely subtle - do not modify casually!
|
// WARNING: The code in this function is extremely subtle - do not modify casually!
|
||||||
|
|
||||||
// method set up to the current depth, allocated lazily
|
// method set up to the current depth, allocated lazily
|
||||||
|
|
@ -124,7 +124,7 @@ func NewMethodSet(typ Type) *MethodSet {
|
||||||
|
|
||||||
// Start with typ as single entry at lowest depth.
|
// Start with typ as single entry at lowest depth.
|
||||||
// If typ is not a named type, insert a nil type instead.
|
// If typ is not a named type, insert a nil type instead.
|
||||||
typ, isPtr := deref(typ)
|
typ, isPtr := deref(T)
|
||||||
t, _ := typ.(*Named)
|
t, _ := typ.(*Named)
|
||||||
current := []embeddedType{{t, nil, isPtr, false}}
|
current := []embeddedType{{t, nil, isPtr, false}}
|
||||||
|
|
||||||
|
|
@ -227,7 +227,7 @@ func NewMethodSet(typ Type) *MethodSet {
|
||||||
var list []*Method
|
var list []*Method
|
||||||
for _, m := range base {
|
for _, m := range base {
|
||||||
if m != nil {
|
if m != nil {
|
||||||
m.recv = typ
|
m.recv = T
|
||||||
list = append(list, m)
|
list = append(list, m)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue