Commit eec1e5d9 authored by Robert Griesemer's avatar Robert Griesemer

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

Change-Id: I8a28a88a655d9929f8641f71573dc01dc53be00f
Reviewed-on: https://go-review.googlesource.com/32443Reviewed-by: default avatarAlan Donovan <adonovan@google.com>
parent 3f6070cc
...@@ -264,7 +264,7 @@ func (p *importer) obj(tag int) { ...@@ -264,7 +264,7 @@ func (p *importer) obj(tag int) {
} }
if aliasName != "" { if aliasName != "" {
p.declare(types.NewAlias(aliasPos, p.pkgList[0], aliasName, 0, obj)) p.declare(types.NewAlias(aliasPos, p.pkgList[0], aliasName, obj))
} }
} }
......
...@@ -218,15 +218,16 @@ func (*Func) isDependency() {} // a function may be a dependency of an initi ...@@ -218,15 +218,16 @@ func (*Func) isDependency() {} // a function may be a dependency of an initi
// An Alias represents a declared alias. // An Alias represents a declared alias.
type Alias struct { type Alias struct {
object object
kind token.Token // token.CONST, token.TYPE, token.VAR, or token.FUNC orig Object // aliased constant, type, variable, or function; never an alias
orig Object // aliased constant, type, variable, or function 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 { func NewAlias(pos token.Pos, pkg *Package, name string, orig Object) *Alias {
return &Alias{object{pos: pos, pkg: pkg, name: name}, kind, orig} return &Alias{object{pos: pos, pkg: pkg, name: name}, orig, token.ILLEGAL}
} }
func (obj *Alias) Kind() token.Token { return obj.kind } // 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 } func (obj *Alias) Orig() Object { return obj.orig }
// A Label represents a declared label. // A Label represents a declared label.
......
...@@ -275,7 +275,8 @@ func (check *Checker) collectObjects() { ...@@ -275,7 +275,8 @@ func (check *Checker) collectObjects() {
} }
case *ast.AliasSpec: 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}) check.declarePkgObj(s.Name, obj, &declInfo{file: fileScope, init: s.Orig})
case *ast.ValueSpec: case *ast.ValueSpec:
......
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