1
0
mirror of https://github.com/golang/go synced 2024-07-08 12:18:55 +00:00

go/types: don't expose types.Alias kind field - only used by go/types

Change-Id: I8a28a88a655d9929f8641f71573dc01dc53be00f
Reviewed-on: https://go-review.googlesource.com/32443
Reviewed-by: Alan Donovan <adonovan@google.com>
This commit is contained in:
Robert Griesemer 2016-10-31 11:16:15 -07:00
parent 3f6070cc91
commit eec1e5d9c6
3 changed files with 10 additions and 8 deletions

View File

@ -264,7 +264,7 @@ func (p *importer) obj(tag int) {
}
if aliasName != "" {
p.declare(types.NewAlias(aliasPos, p.pkgList[0], aliasName, 0, obj))
p.declare(types.NewAlias(aliasPos, p.pkgList[0], aliasName, obj))
}
}

View File

@ -218,16 +218,17 @@ func (*Func) isDependency() {} // a function may be a dependency of an initi
// An Alias represents a declared alias.
type Alias struct {
object
kind token.Token // token.CONST, token.TYPE, token.VAR, or token.FUNC
orig Object // aliased constant, type, variable, or function
orig Object // aliased constant, type, variable, or function; never an alias
kind token.Token // token.CONST, token.TYPE, token.VAR, or token.FUNC (type-checking internal use only)
}
func NewAlias(pos token.Pos, pkg *Package, name string, kind token.Token, orig Object) *Alias {
return &Alias{object{pos: pos, pkg: pkg, name: name}, kind, orig}
func NewAlias(pos token.Pos, pkg *Package, name string, orig Object) *Alias {
return &Alias{object{pos: pos, pkg: pkg, name: name}, orig, token.ILLEGAL}
}
func (obj *Alias) Kind() token.Token { return obj.kind }
func (obj *Alias) Orig() Object { return obj.orig }
// Orig returns the aliased object, or nil if there was an error.
// The returned object is never an Alias.
func (obj *Alias) Orig() Object { return obj.orig }
// A Label represents a declared label.
type Label struct {

View File

@ -275,7 +275,8 @@ func (check *Checker) collectObjects() {
}
case *ast.AliasSpec:
obj := NewAlias(s.Name.Pos(), pkg, s.Name.Name, d.Tok, nil)
obj := NewAlias(s.Name.Pos(), pkg, s.Name.Name, nil)
obj.kind = d.Tok
check.declarePkgObj(s.Name, obj, &declInfo{file: fileScope, init: s.Orig})
case *ast.ValueSpec: