Commit d7cabd40 authored by Robert Griesemer's avatar Robert Griesemer

[dev.typealias] go/types: clarified doc string

Also: removed internal TODO and added better comment

Fixes #18644.

Change-Id: I3e3763d3afdad6937173cdd32fc661618fb60820
Reviewed-on: https://go-review.googlesource.com/35245
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: 's avatarJosh Bleecher Snyder <josharian@gmail.com>
parent cc2dcce3
...@@ -25,7 +25,7 @@ type Object interface { ...@@ -25,7 +25,7 @@ type Object interface {
Name() string // package local object name Name() string // package local object name
Type() Type // object type Type() Type // object type
Exported() bool // reports whether the name starts with a capital letter Exported() bool // reports whether the name starts with a capital letter
Id() string // object id (see Id below) Id() string // object name if exported, qualified name if not exported (see func Id)
// String returns a human-readable string of the object. // String returns a human-readable string of the object.
String() string String() string
...@@ -64,15 +64,10 @@ func Id(pkg *Package, name string) string { ...@@ -64,15 +64,10 @@ func Id(pkg *Package, name string) string {
// inside a package and outside a package - which breaks some // inside a package and outside a package - which breaks some
// tests) // tests)
path := "_" path := "_"
// TODO(gri): shouldn't !ast.IsExported(name) => pkg != nil be an precondition? // pkg is nil for objects in Universe scope and possibly types
// if pkg == nil { // introduced via Eval (see also comment in object.sameId)
// panic("nil package in lookup of unexported name") if pkg != nil && pkg.path != "" {
// }
if pkg != nil {
path = pkg.path path = pkg.path
if path == "" {
path = "_"
}
} }
return path + "." + name return path + "." + name
} }
......
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