Documentation
¶
Index ¶
- func PackageScope(p *types.Package, typesInfo *types.Info) (Scope, *Info)
- type DefMap
- func (m DefMap) Add(name string, pos ...token.Pos)
- func (m DefMap) DeleteFunc(name string, f func(pos token.Pos) bool)
- func (m DefMap) Lookup(name string) []token.Pos
- func (m DefMap) LookupFunc(name string, f func(pos token.Pos) bool) []token.Pos
- func (m DefMap) Rename(name string, def token.Pos, newName string)
- type Info
- type Scope
- type Use
- type UseMap
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DefMap ¶
func (DefMap) LookupFunc ¶
type Scope ¶
type Scope interface {
// Parent returns the parent scope of this scope. Nil if this scope is universe.
Parent() Scope
// LookupDef returns the position of definition of name in this scope.
// If the name is not defined in this scope, ([token.NoPos], false) is returned.
LookupDef(name string) token.Pos
// LookupUse returns all the usages of name in this scope.
// If no usage is found, the result is nil.
LookupUse(name string) []defUsePos
// RenameChildren follows the children chain of scopes starting with scope
// to rename the definition and all usages of name defined at a specified position.
RenameChildren(name string, def token.Pos, newName string)
// Scope returns the scope corresponding to s.
Scope(s *types.Scope) Scope
// CanDef returns whether a new name can be defined at pos in this scope.
CanDef(name string, pos token.Pos) bool
// CanUse returns whether a new name can be used at pos in this scope.
// Parameter defScope is the scope where the name would be defined.
CanUse(name string, pos token.Pos, defScope Scope) bool
// contains filtered or unexported methods
}
Scope is a lexical scope of go source code.
Click to show internal directories.
Click to hide internal directories.