Documentation ¶
Overview ¶
Types infers source locations and types from Go expressions. and allows enumeration of the type's method or field members.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Debug = false
When Debug is true, log messages will be printed.
var FileSet = token.NewFileSet()
When DefaultImporter is called, it adds any files to FileSet.
var Panic = true
Functions ¶
func DeclPos ¶
DeclPos computes the source position of the declaration of an object name. The result may be an invalid position if it cannot be computed (obj.Decl may be nil or not correct). This should be called ast.Object.Pos.
func DefaultImportPathToName ¶
DefaultImportPathToName returns the package identifier for the given import path.
Types ¶
type MultiValue ¶
MultiValue represents a multiple valued Go expression - the result of a function that returns more than one value.
func (MultiValue) End ¶
func (MultiValue) End() token.Pos
func (MultiValue) Pos ¶
func (MultiValue) Pos() token.Pos
type Type ¶
type Type struct { // Parse-tree representation of the expression's type. Node ast.Node // The kind of the expression. Kind ast.ObjKind // The path of the package that the type is relative to. Pkg string // contains filtered or unexported fields }
Type represents the type of a Go expression. It can represent a Go package and a Go type as well as the usual expression types.
func ExprType ¶
ExprType returns the type for the given expression, and the object that represents it, if there is one. All variables, methods, top level functions, packages, struct and interface members, and types have objects. The returned object can be used with DeclPos to find out the source location of the definition of the object.
func (Type) Iter ¶
Iter returns a channel, sends on it all the members of the type, then closes it. Members at a shallower depth will be sent first.
func (Type) Member ¶
Member looks for a member with the given name inside the type. For packages, the member can be any exported top level declaration inside the package.
func (Type) Underlying ¶
If typ represents a named type, Underlying returns the type that it was defined as. If all is true, it repeats this process until the type is not a named type.