Documentation
¶
Overview ¶
Package locateutil provides utility routines for use with its parent locate package.
Index ¶
- func CommentGroupBounds(comments []*ast.CommentGroup) (first, last token.Pos)
- func CommentGroupsContain(comments []*ast.CommentGroup, text string) bool
- func FunctionCalls(decl *ast.FuncDecl, callname *regexp.Regexp, deferred bool) []ast.Node
- func FunctionHasComment(decl *ast.FuncDecl, cmap ast.CommentMap, text string) bool
- func FunctionStatements(decl *ast.FuncDecl) int
- func ImportBlock(file *ast.File) (start, end token.Pos)
- func InterfaceType(typ types.Type) *types.Interface
- func IsAbstract(fn *types.Func) bool
- func IsImportedByFile(file *ast.File, path string) bool
- func IsInterfaceDefinition(pkg *packages.Package, obj types.Object) *types.Interface
- type FuncDesc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CommentGroupBounds ¶
func CommentGroupBounds(comments []*ast.CommentGroup) (first, last token.Pos)
CommentGroupBounds returns the lowest and largest token.Pos of any of the supplied CommentGroups.
func CommentGroupsContain ¶
func CommentGroupsContain(comments []*ast.CommentGroup, text string) bool
CommentGroupsContain returns if any of the supplied CommentGroups contain 'text'.
func FunctionCalls ¶
FunctionCalls determines if the supplied function declaration contains a call 'callname' where callname is either a function name or a selector (eg. foo.bar). If deferred is true the function call must be defer'ed.
func FunctionHasComment ¶
FunctionHasComment returns true if any of the comments associated or within the function contain the specified text.
func FunctionStatements ¶
FunctionStatements returns number of top-level statements in a function.
func ImportBlock ¶
ImportBlock returns the start and end positions of an import statement or import block for the supplied file.
func InterfaceType ¶
InterfaceType returns the underlying *types.Interface if typ represents an interface or nil otherwise.
func IsAbstract ¶
IsAbstract returns true if the function declaration is abstract.
func IsImportedByFile ¶
IsImportedByFile returns true if the supplied path appears in the Imports section of an ast.File.
func IsInterfaceDefinition ¶
IsInterfaceDefinition returns the interface type that the suplied object defines in the specified package, if any. This specifically excludes embedded types which are defined in other packages and anonymous interfaces.