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.
GoPath is used by DefaultImporter to find packages.
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 DefaultImporter ¶
DefaultGetPackage looks for the package; if it finds it, it parses and returns it. If no package was found, it returns nil.
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 }
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.