mirror of
https://github.com/golang/go
synced 2024-09-05 07:54:46 +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:
parent
3f6070cc91
commit
eec1e5d9c6
|
@ -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
|
||||||
// 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() {
|
||||||
}
|
}
|
||||||
|
|
||||||
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:
|
||||||
|
|
Loading…
Reference in a new issue