astrav

package
v0.4.3-0...-af5a74a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 27, 2020 License: AGPL-3.0 Imports: 18 Imported by: 0

README

Astrav

GolangCI

Summary

An AST traversal library to check Go code structure. It wraps Go's ast library and provides a parent - child structure and a lot of convenience functions like searching nodes by name, or ast type within another node. Also searching in the call tree is supported which follows function calls.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Parse

func Parse(fset *token.FileSet, root http.FileSystem, dir string, filter func(os.FileInfo) bool,
	mode parser.Mode) (pkgs map[string]*ast.Package, fileSources map[string][]byte, first error)

Parse calls ParseFile for all files with names ending in ".go" in the http.FileSystem specified by path and returns a map of package name -> package AST with all the packages found.

If filter != nil, only the files with os.FileInfo entries passing through the filter (and ending in ".go") are considered. The mode bits are passed to ParseFile unchanged. Position information is recorded in fset, which must not be nil.

If the directory couldn't be read, a nil map and the respective error are returned. If a parse error occurred, a non-nil but incomplete map and the first error encountered are returned.

Types

type ArrayType

type ArrayType struct {
	*ast.ArrayType
	// contains filtered or unexported fields
}

ArrayType wraps ast.ArrayType

func (*ArrayType) AstNode

func (s *ArrayType) AstNode() ast.Node

AstNode returns the original ast.Node

func (ArrayType) CallTreeNode

func (s ArrayType) CallTreeNode(cond func(n Node) bool) Node

CallTreeNode walks the call tree returning the first node that meets the condition

func (ArrayType) CallTreeNodes

func (s ArrayType) CallTreeNodes(cond func(n Node) bool) []Node

CallTreeNodes walks the call tree collecting all nodes that meet the condition

func (*ArrayType) ChildByName

func (s *ArrayType) ChildByName(name string) Node

ChildByName retrieves a node among the direkt children by name (only nodes that have a name)

func (*ArrayType) ChildByNodeType

func (s *ArrayType) ChildByNodeType(nodeType NodeType) Node

ChildByNodeType returns the first child of a certain type.

func (*ArrayType) ChildNode

func (s *ArrayType) ChildNode(cond func(n Node) bool) Node

ChildNode walks only child nodes returning the first node that meets the condition

func (*ArrayType) ChildNodes

func (s *ArrayType) ChildNodes(cond func(n Node) bool) []Node

ChildNodes walks only child nodes collecting all nodes that meet the condition

func (*ArrayType) Children

func (s *ArrayType) Children() []Node

Children returns all child nodes

func (*ArrayType) ChildrenByNodeType

func (s *ArrayType) ChildrenByNodeType(nodeType NodeType) []Node

ChildrenByNodeType returns the first child of a certain type.

func (*ArrayType) Contains

func (s *ArrayType) Contains(node Node) bool

Contains checks if a node contains another node

func (*ArrayType) FindByName

func (s *ArrayType) FindByName(name string) []Node

FindByName looks for a name in the entire sub tree

func (*ArrayType) FindByNodeType

func (s *ArrayType) FindByNodeType(nodeType NodeType) []Node

FindByNodeType returns all sub nodes of a certain type

func (*ArrayType) FindByToken

func (s *ArrayType) FindByToken(t token.Token) []Node

FindByToken finds a node with a token.Token attached and of given token type

func (*ArrayType) FindByValueType

func (s *ArrayType) FindByValueType(valType string) []Node

FindByValueType find all nodes with given value type

func (*ArrayType) FindDeclarations

func (s *ArrayType) FindDeclarations() []*Ident

FindDeclarations finds all declarations

func (*ArrayType) FindDeclarationsByType

func (s *ArrayType) FindDeclarationsByType(nodeType NodeType) []*Ident

FindDeclarationsByType finds all declarations by (parent) type

func (*ArrayType) FindFirstByName

func (s *ArrayType) FindFirstByName(name string) Node

FindFirstByName looks for a name in the entire sub tree. First node is returned if there are multiple.

func (*ArrayType) FindFirstByNodeType

func (s *ArrayType) FindFirstByNodeType(nodeType NodeType) Node

FindFirstByNodeType returns the first sub node of a certain type

func (*ArrayType) FindFirstIdentByName

func (s *ArrayType) FindFirstIdentByName(name string) *Ident

FindFirstIdentByName looks for the first Ident node in subtree with given name

func (*ArrayType) FindFirstUsage

func (s *ArrayType) FindFirstUsage(declaration *Ident) *Ident

FindFirstUsage selects the first usage

func (*ArrayType) FindIdentByName

func (s *ArrayType) FindIdentByName(name string) []*Ident

FindIdentByName looks for Ident nodes in the entire sub tree with given name

func (*ArrayType) FindMaps

func (s *ArrayType) FindMaps() []Node

FindMaps find all nodes with given value type

func (*ArrayType) FindNameInCallTree

func (s *ArrayType) FindNameInCallTree(name string) []Node

FindNameInCallTree returns all nodes in call tree with given name

func (*ArrayType) FindNodeTypeInCallTree

func (s *ArrayType) FindNodeTypeInCallTree(nodeType NodeType) []Node

FindNodeTypeInCallTree returns all nodes in call tree of a certain type

func (*ArrayType) FindUsages

func (s *ArrayType) FindUsages(declaration *Ident) []*Ident

FindUsages finds usages of given declaration

func (*ArrayType) FindVarDeclarations

func (s *ArrayType) FindVarDeclarations() []*Ident

FindVarDeclarations finds all assignStmt (:=), valueSpec (var, const) declarations

func (*ArrayType) GetIdent

func (s *ArrayType) GetIdent() *Ident

GetIdent returns the name of the node

func (*ArrayType) GetScope

func (s *ArrayType) GetScope() (Node, *types.Scope)

GetScope returns the scope of the node

func (*ArrayType) GetSource

func (s *ArrayType) GetSource() []byte

GetSource returns the source code of the current node

func (*ArrayType) GetSourceString

func (s *ArrayType) GetSourceString() string

GetSourceString is a convenience function to GetSource as string

func (*ArrayType) Info

func (s *ArrayType) Info() *types.Info

Info returns the types.info node.

func (*ArrayType) IsContainedByType

func (s *ArrayType) IsContainedByType(nodeType NodeType) bool

IsContainedByType checks if node is contained by a node of given node type

func (*ArrayType) IsNodeType

func (s *ArrayType) IsNodeType(nodeType NodeType) bool

IsNodeType checks if node is of given node type

func (*ArrayType) IsValueType

func (s *ArrayType) IsValueType(valType string) bool

IsValueType checks if value type is of given type

func (*ArrayType) Level

func (s *ArrayType) Level() int

Level returns the level counted from instantiated node = 0

func (*ArrayType) Match

func (s *ArrayType) Match(regex regexp.Regexp) bool

Match matches the source code of current node and content with given regex

func (*ArrayType) NextParentByType

func (s *ArrayType) NextParentByType(nodeType NodeType) Node

NextParentByType returns the next parent of given type

func (*ArrayType) NodeName

func (s *ArrayType) NodeName() string

NodeName returns the name of the node

func (*ArrayType) NodeType

func (s *ArrayType) NodeType() NodeType

NodeType returns the NodeType of the node

func (*ArrayType) Object

func (s *ArrayType) Object() types.Object

Object returns the object of an identifier, nil otherwise

func (*ArrayType) Parent

func (s *ArrayType) Parent() Node

Parent return the parent node

func (*ArrayType) Parents

func (s *ArrayType) Parents() []Node

Parents returns the parent path of nodes

func (*ArrayType) Pkg

func (s *ArrayType) Pkg() *Package

Pkg returns the package this node belongs to.

func (*ArrayType) Siblings

func (s *ArrayType) Siblings() []Node

Siblings returns all sibling nodes

func (*ArrayType) TreeNode

func (s *ArrayType) TreeNode(cond func(n Node) bool) Node

TreeNode walks the child tree returning the first node that meets the condition

func (*ArrayType) TreeNodes

func (s *ArrayType) TreeNodes(cond func(n Node) bool) []Node

TreeNodes walks the child tree collecting all nodes that meet the condition

func (*ArrayType) ValueType

func (s *ArrayType) ValueType() types.Type

ValueType returns value type information of an expression, nil otherwise

func (*ArrayType) Visit

func (s *ArrayType) Visit(node ast.Node) ast.Visitor

Visit implements the ast.Visitor interface and is used to walk the underlying ast.Node tree

func (*ArrayType) Walk

func (s *ArrayType) Walk(f func(node Node) bool)

Walk traverses the tree and its children. return false to skip children of the current element

type AssignStmt

type AssignStmt struct {
	*ast.AssignStmt
	// contains filtered or unexported fields
}

AssignStmt wraps ast.AssignStmt

func (*AssignStmt) AstNode

func (s *AssignStmt) AstNode() ast.Node

AstNode returns the original ast.Node

func (AssignStmt) CallTreeNode

func (s AssignStmt) CallTreeNode(cond func(n Node) bool) Node

CallTreeNode walks the call tree returning the first node that meets the condition

func (AssignStmt) CallTreeNodes

func (s AssignStmt) CallTreeNodes(cond func(n Node) bool) []Node

CallTreeNodes walks the call tree collecting all nodes that meet the condition

func (*AssignStmt) ChildByName

func (s *AssignStmt) ChildByName(name string) Node

ChildByName retrieves a node among the direkt children by name (only nodes that have a name)

func (*AssignStmt) ChildByNodeType

func (s *AssignStmt) ChildByNodeType(nodeType NodeType) Node

ChildByNodeType returns the first child of a certain type.

func (*AssignStmt) ChildNode

func (s *AssignStmt) ChildNode(cond func(n Node) bool) Node

ChildNode walks only child nodes returning the first node that meets the condition

func (*AssignStmt) ChildNodes

func (s *AssignStmt) ChildNodes(cond func(n Node) bool) []Node

ChildNodes walks only child nodes collecting all nodes that meet the condition

func (*AssignStmt) Children

func (s *AssignStmt) Children() []Node

Children returns all child nodes

func (*AssignStmt) ChildrenByNodeType

func (s *AssignStmt) ChildrenByNodeType(nodeType NodeType) []Node

ChildrenByNodeType returns the first child of a certain type.

func (*AssignStmt) Contains

func (s *AssignStmt) Contains(node Node) bool

Contains checks if a node contains another node

func (*AssignStmt) FindByName

func (s *AssignStmt) FindByName(name string) []Node

FindByName looks for a name in the entire sub tree

func (*AssignStmt) FindByNodeType

func (s *AssignStmt) FindByNodeType(nodeType NodeType) []Node

FindByNodeType returns all sub nodes of a certain type

func (*AssignStmt) FindByToken

func (s *AssignStmt) FindByToken(t token.Token) []Node

FindByToken finds a node with a token.Token attached and of given token type

func (*AssignStmt) FindByValueType

func (s *AssignStmt) FindByValueType(valType string) []Node

FindByValueType find all nodes with given value type

func (*AssignStmt) FindDeclarations

func (s *AssignStmt) FindDeclarations() []*Ident

FindDeclarations finds all declarations

func (*AssignStmt) FindDeclarationsByType

func (s *AssignStmt) FindDeclarationsByType(nodeType NodeType) []*Ident

FindDeclarationsByType finds all declarations by (parent) type

func (*AssignStmt) FindFirstByName

func (s *AssignStmt) FindFirstByName(name string) Node

FindFirstByName looks for a name in the entire sub tree. First node is returned if there are multiple.

func (*AssignStmt) FindFirstByNodeType

func (s *AssignStmt) FindFirstByNodeType(nodeType NodeType) Node

FindFirstByNodeType returns the first sub node of a certain type

func (*AssignStmt) FindFirstIdentByName

func (s *AssignStmt) FindFirstIdentByName(name string) *Ident

FindFirstIdentByName looks for the first Ident node in subtree with given name

func (*AssignStmt) FindFirstUsage

func (s *AssignStmt) FindFirstUsage(declaration *Ident) *Ident

FindFirstUsage selects the first usage

func (*AssignStmt) FindIdentByName

func (s *AssignStmt) FindIdentByName(name string) []*Ident

FindIdentByName looks for Ident nodes in the entire sub tree with given name

func (*AssignStmt) FindMaps

func (s *AssignStmt) FindMaps() []Node

FindMaps find all nodes with given value type

func (*AssignStmt) FindNameInCallTree

func (s *AssignStmt) FindNameInCallTree(name string) []Node

FindNameInCallTree returns all nodes in call tree with given name

func (*AssignStmt) FindNodeTypeInCallTree

func (s *AssignStmt) FindNodeTypeInCallTree(nodeType NodeType) []Node

FindNodeTypeInCallTree returns all nodes in call tree of a certain type

func (*AssignStmt) FindUsages

func (s *AssignStmt) FindUsages(declaration *Ident) []*Ident

FindUsages finds usages of given declaration

func (*AssignStmt) FindVarDeclarations

func (s *AssignStmt) FindVarDeclarations() []*Ident

FindVarDeclarations finds all assignStmt (:=), valueSpec (var, const) declarations

func (*AssignStmt) GetScope

func (s *AssignStmt) GetScope() (Node, *types.Scope)

GetScope returns the scope of the node

func (*AssignStmt) GetSource

func (s *AssignStmt) GetSource() []byte

GetSource returns the source code of the current node

func (*AssignStmt) GetSourceString

func (s *AssignStmt) GetSourceString() string

GetSourceString is a convenience function to GetSource as string

func (*AssignStmt) Info

func (s *AssignStmt) Info() *types.Info

Info returns the types.info node.

func (*AssignStmt) IsContainedByType

func (s *AssignStmt) IsContainedByType(nodeType NodeType) bool

IsContainedByType checks if node is contained by a node of given node type

func (*AssignStmt) IsNodeType

func (s *AssignStmt) IsNodeType(nodeType NodeType) bool

IsNodeType checks if node is of given node type

func (*AssignStmt) IsValueType

func (s *AssignStmt) IsValueType(valType string) bool

IsValueType checks if value type is of given type

func (*AssignStmt) LHS

func (s *AssignStmt) LHS() []Node

LHS returns left hand side nodes

func (*AssignStmt) Level

func (s *AssignStmt) Level() int

Level returns the level counted from instantiated node = 0

func (*AssignStmt) Match

func (s *AssignStmt) Match(regex regexp.Regexp) bool

Match matches the source code of current node and content with given regex

func (*AssignStmt) NextParentByType

func (s *AssignStmt) NextParentByType(nodeType NodeType) Node

NextParentByType returns the next parent of given type

func (*AssignStmt) NodeType

func (s *AssignStmt) NodeType() NodeType

NodeType returns the NodeType of the node

func (*AssignStmt) Object

func (s *AssignStmt) Object() types.Object

Object returns the object of an identifier, nil otherwise

func (*AssignStmt) Parent

func (s *AssignStmt) Parent() Node

Parent return the parent node

func (*AssignStmt) Parents

func (s *AssignStmt) Parents() []Node

Parents returns the parent path of nodes

func (*AssignStmt) Pkg

func (s *AssignStmt) Pkg() *Package

Pkg returns the package this node belongs to.

func (*AssignStmt) RHS

func (s *AssignStmt) RHS() []Node

RHS returns right hand side nodes

func (*AssignStmt) Siblings

func (s *AssignStmt) Siblings() []Node

Siblings returns all sibling nodes

func (*AssignStmt) Token

func (s *AssignStmt) Token() token.Token

Token returns the token of the node

func (*AssignStmt) TreeNode

func (s *AssignStmt) TreeNode(cond func(n Node) bool) Node

TreeNode walks the child tree returning the first node that meets the condition

func (*AssignStmt) TreeNodes

func (s *AssignStmt) TreeNodes(cond func(n Node) bool) []Node

TreeNodes walks the child tree collecting all nodes that meet the condition

func (*AssignStmt) ValueType

func (s *AssignStmt) ValueType() types.Type

ValueType returns value type information of an expression, nil otherwise

func (*AssignStmt) Visit

func (s *AssignStmt) Visit(node ast.Node) ast.Visitor

Visit implements the ast.Visitor interface and is used to walk the underlying ast.Node tree

func (*AssignStmt) Walk

func (s *AssignStmt) Walk(f func(node Node) bool)

Walk traverses the tree and its children. return false to skip children of the current element

type BadDecl

type BadDecl struct {
	*ast.BadDecl
	// contains filtered or unexported fields
}

BadDecl wraps ast.BadDecl

func (*BadDecl) AstNode

func (s *BadDecl) AstNode() ast.Node

AstNode returns the original ast.Node

func (BadDecl) CallTreeNode

func (s BadDecl) CallTreeNode(cond func(n Node) bool) Node

CallTreeNode walks the call tree returning the first node that meets the condition

func (BadDecl) CallTreeNodes

func (s BadDecl) CallTreeNodes(cond func(n Node) bool) []Node

CallTreeNodes walks the call tree collecting all nodes that meet the condition

func (*BadDecl) ChildByName

func (s *BadDecl) ChildByName(name string) Node

ChildByName retrieves a node among the direkt children by name (only nodes that have a name)

func (*BadDecl) ChildByNodeType

func (s *BadDecl) ChildByNodeType(nodeType NodeType) Node

ChildByNodeType returns the first child of a certain type.

func (*BadDecl) ChildNode

func (s *BadDecl) ChildNode(cond func(n Node) bool) Node

ChildNode walks only child nodes returning the first node that meets the condition

func (*BadDecl) ChildNodes

func (s *BadDecl) ChildNodes(cond func(n Node) bool) []Node

ChildNodes walks only child nodes collecting all nodes that meet the condition

func (*BadDecl) Children

func (s *BadDecl) Children() []Node

Children returns all child nodes

func (*BadDecl) ChildrenByNodeType

func (s *BadDecl) ChildrenByNodeType(nodeType NodeType) []Node

ChildrenByNodeType returns the first child of a certain type.

func (*BadDecl) Contains

func (s *BadDecl) Contains(node Node) bool

Contains checks if a node contains another node

func (*BadDecl) FindByName

func (s *BadDecl) FindByName(name string) []Node

FindByName looks for a name in the entire sub tree

func (*BadDecl) FindByNodeType

func (s *BadDecl) FindByNodeType(nodeType NodeType) []Node

FindByNodeType returns all sub nodes of a certain type

func (*BadDecl) FindByToken

func (s *BadDecl) FindByToken(t token.Token) []Node

FindByToken finds a node with a token.Token attached and of given token type

func (*BadDecl) FindByValueType

func (s *BadDecl) FindByValueType(valType string) []Node

FindByValueType find all nodes with given value type

func (*BadDecl) FindDeclarations

func (s *BadDecl) FindDeclarations() []*Ident

FindDeclarations finds all declarations

func (*BadDecl) FindDeclarationsByType

func (s *BadDecl) FindDeclarationsByType(nodeType NodeType) []*Ident

FindDeclarationsByType finds all declarations by (parent) type

func (*BadDecl) FindFirstByName

func (s *BadDecl) FindFirstByName(name string) Node

FindFirstByName looks for a name in the entire sub tree. First node is returned if there are multiple.

func (*BadDecl) FindFirstByNodeType

func (s *BadDecl) FindFirstByNodeType(nodeType NodeType) Node

FindFirstByNodeType returns the first sub node of a certain type

func (*BadDecl) FindFirstIdentByName

func (s *BadDecl) FindFirstIdentByName(name string) *Ident

FindFirstIdentByName looks for the first Ident node in subtree with given name

func (*BadDecl) FindFirstUsage

func (s *BadDecl) FindFirstUsage(declaration *Ident) *Ident

FindFirstUsage selects the first usage

func (*BadDecl) FindIdentByName

func (s *BadDecl) FindIdentByName(name string) []*Ident

FindIdentByName looks for Ident nodes in the entire sub tree with given name

func (*BadDecl) FindMaps

func (s *BadDecl) FindMaps() []Node

FindMaps find all nodes with given value type

func (*BadDecl) FindNameInCallTree

func (s *BadDecl) FindNameInCallTree(name string) []Node

FindNameInCallTree returns all nodes in call tree with given name

func (*BadDecl) FindNodeTypeInCallTree

func (s *BadDecl) FindNodeTypeInCallTree(nodeType NodeType) []Node

FindNodeTypeInCallTree returns all nodes in call tree of a certain type

func (*BadDecl) FindUsages

func (s *BadDecl) FindUsages(declaration *Ident) []*Ident

FindUsages finds usages of given declaration

func (*BadDecl) FindVarDeclarations

func (s *BadDecl) FindVarDeclarations() []*Ident

FindVarDeclarations finds all assignStmt (:=), valueSpec (var, const) declarations

func (*BadDecl) GetScope

func (s *BadDecl) GetScope() (Node, *types.Scope)

GetScope returns the scope of the node

func (*BadDecl) GetSource

func (s *BadDecl) GetSource() []byte

GetSource returns the source code of the current node

func (*BadDecl) GetSourceString

func (s *BadDecl) GetSourceString() string

GetSourceString is a convenience function to GetSource as string

func (*BadDecl) Info

func (s *BadDecl) Info() *types.Info

Info returns the types.info node.

func (*BadDecl) IsContainedByType

func (s *BadDecl) IsContainedByType(nodeType NodeType) bool

IsContainedByType checks if node is contained by a node of given node type

func (*BadDecl) IsNodeType

func (s *BadDecl) IsNodeType(nodeType NodeType) bool

IsNodeType checks if node is of given node type

func (*BadDecl) IsValueType

func (s *BadDecl) IsValueType(valType string) bool

IsValueType checks if value type is of given type

func (*BadDecl) Level

func (s *BadDecl) Level() int

Level returns the level counted from instantiated node = 0

func (*BadDecl) Match

func (s *BadDecl) Match(regex regexp.Regexp) bool

Match matches the source code of current node and content with given regex

func (*BadDecl) NextParentByType

func (s *BadDecl) NextParentByType(nodeType NodeType) Node

NextParentByType returns the next parent of given type

func (*BadDecl) NodeType

func (s *BadDecl) NodeType() NodeType

NodeType returns the NodeType of the node

func (*BadDecl) Object

func (s *BadDecl) Object() types.Object

Object returns the object of an identifier, nil otherwise

func (*BadDecl) Parent

func (s *BadDecl) Parent() Node

Parent return the parent node

func (*BadDecl) Parents

func (s *BadDecl) Parents() []Node

Parents returns the parent path of nodes

func (*BadDecl) Pkg

func (s *BadDecl) Pkg() *Package

Pkg returns the package this node belongs to.

func (*BadDecl) Siblings

func (s *BadDecl) Siblings() []Node

Siblings returns all sibling nodes

func (*BadDecl) TreeNode

func (s *BadDecl) TreeNode(cond func(n Node) bool) Node

TreeNode walks the child tree returning the first node that meets the condition

func (*BadDecl) TreeNodes

func (s *BadDecl) TreeNodes(cond func(n Node) bool) []Node

TreeNodes walks the child tree collecting all nodes that meet the condition

func (*BadDecl) ValueType

func (s *BadDecl) ValueType() types.Type

ValueType returns value type information of an expression, nil otherwise

func (*BadDecl) Visit

func (s *BadDecl) Visit(node ast.Node) ast.Visitor

Visit implements the ast.Visitor interface and is used to walk the underlying ast.Node tree

func (*BadDecl) Walk

func (s *BadDecl) Walk(f func(node Node) bool)

Walk traverses the tree and its children. return false to skip children of the current element

type BadExpr

type BadExpr struct {
	*ast.BadExpr
	// contains filtered or unexported fields
}

BadExpr wraps ast.BadExpr

func (*BadExpr) AstNode

func (s *BadExpr) AstNode() ast.Node

AstNode returns the original ast.Node

func (BadExpr) CallTreeNode

func (s BadExpr) CallTreeNode(cond func(n Node) bool) Node

CallTreeNode walks the call tree returning the first node that meets the condition

func (BadExpr) CallTreeNodes

func (s BadExpr) CallTreeNodes(cond func(n Node) bool) []Node

CallTreeNodes walks the call tree collecting all nodes that meet the condition

func (*BadExpr) ChildByName

func (s *BadExpr) ChildByName(name string) Node

ChildByName retrieves a node among the direkt children by name (only nodes that have a name)

func (*BadExpr) ChildByNodeType

func (s *BadExpr) ChildByNodeType(nodeType NodeType) Node

ChildByNodeType returns the first child of a certain type.

func (*BadExpr) ChildNode

func (s *BadExpr) ChildNode(cond func(n Node) bool) Node

ChildNode walks only child nodes returning the first node that meets the condition

func (*BadExpr) ChildNodes

func (s *BadExpr) ChildNodes(cond func(n Node) bool) []Node

ChildNodes walks only child nodes collecting all nodes that meet the condition

func (*BadExpr) Children

func (s *BadExpr) Children() []Node

Children returns all child nodes

func (*BadExpr) ChildrenByNodeType

func (s *BadExpr) ChildrenByNodeType(nodeType NodeType) []Node

ChildrenByNodeType returns the first child of a certain type.

func (*BadExpr) Contains

func (s *BadExpr) Contains(node Node) bool

Contains checks if a node contains another node

func (*BadExpr) FindByName

func (s *BadExpr) FindByName(name string) []Node

FindByName looks for a name in the entire sub tree

func (*BadExpr) FindByNodeType

func (s *BadExpr) FindByNodeType(nodeType NodeType) []Node

FindByNodeType returns all sub nodes of a certain type

func (*BadExpr) FindByToken

func (s *BadExpr) FindByToken(t token.Token) []Node

FindByToken finds a node with a token.Token attached and of given token type

func (*BadExpr) FindByValueType

func (s *BadExpr) FindByValueType(valType string) []Node

FindByValueType find all nodes with given value type

func (*BadExpr) FindDeclarations

func (s *BadExpr) FindDeclarations() []*Ident

FindDeclarations finds all declarations

func (*BadExpr) FindDeclarationsByType

func (s *BadExpr) FindDeclarationsByType(nodeType NodeType) []*Ident

FindDeclarationsByType finds all declarations by (parent) type

func (*BadExpr) FindFirstByName

func (s *BadExpr) FindFirstByName(name string) Node

FindFirstByName looks for a name in the entire sub tree. First node is returned if there are multiple.

func (*BadExpr) FindFirstByNodeType

func (s *BadExpr) FindFirstByNodeType(nodeType NodeType) Node

FindFirstByNodeType returns the first sub node of a certain type

func (*BadExpr) FindFirstIdentByName

func (s *BadExpr) FindFirstIdentByName(name string) *Ident

FindFirstIdentByName looks for the first Ident node in subtree with given name

func (*BadExpr) FindFirstUsage

func (s *BadExpr) FindFirstUsage(declaration *Ident) *Ident

FindFirstUsage selects the first usage

func (*BadExpr) FindIdentByName

func (s *BadExpr) FindIdentByName(name string) []*Ident

FindIdentByName looks for Ident nodes in the entire sub tree with given name

func (*BadExpr) FindMaps

func (s *BadExpr) FindMaps() []Node

FindMaps find all nodes with given value type

func (*BadExpr) FindNameInCallTree

func (s *BadExpr) FindNameInCallTree(name string) []Node

FindNameInCallTree returns all nodes in call tree with given name

func (*BadExpr) FindNodeTypeInCallTree

func (s *BadExpr) FindNodeTypeInCallTree(nodeType NodeType) []Node

FindNodeTypeInCallTree returns all nodes in call tree of a certain type

func (*BadExpr) FindUsages

func (s *BadExpr) FindUsages(declaration *Ident) []*Ident

FindUsages finds usages of given declaration

func (*BadExpr) FindVarDeclarations

func (s *BadExpr) FindVarDeclarations() []*Ident

FindVarDeclarations finds all assignStmt (:=), valueSpec (var, const) declarations

func (*BadExpr) GetScope

func (s *BadExpr) GetScope() (Node, *types.Scope)

GetScope returns the scope of the node

func (*BadExpr) GetSource

func (s *BadExpr) GetSource() []byte

GetSource returns the source code of the current node

func (*BadExpr) GetSourceString

func (s *BadExpr) GetSourceString() string

GetSourceString is a convenience function to GetSource as string

func (*BadExpr) Info

func (s *BadExpr) Info() *types.Info

Info returns the types.info node.

func (*BadExpr) IsContainedByType

func (s *BadExpr) IsContainedByType(nodeType NodeType) bool

IsContainedByType checks if node is contained by a node of given node type

func (*BadExpr) IsNodeType

func (s *BadExpr) IsNodeType(nodeType NodeType) bool

IsNodeType checks if node is of given node type

func (*BadExpr) IsValueType

func (s *BadExpr) IsValueType(valType string) bool

IsValueType checks if value type is of given type

func (*BadExpr) Level

func (s *BadExpr) Level() int

Level returns the level counted from instantiated node = 0

func (*BadExpr) Match

func (s *BadExpr) Match(regex regexp.Regexp) bool

Match matches the source code of current node and content with given regex

func (*BadExpr) NextParentByType

func (s *BadExpr) NextParentByType(nodeType NodeType) Node

NextParentByType returns the next parent of given type

func (*BadExpr) NodeType

func (s *BadExpr) NodeType() NodeType

NodeType returns the NodeType of the node

func (*BadExpr) Object

func (s *BadExpr) Object() types.Object

Object returns the object of an identifier, nil otherwise

func (*BadExpr) Parent

func (s *BadExpr) Parent() Node

Parent return the parent node

func (*BadExpr) Parents

func (s *BadExpr) Parents() []Node

Parents returns the parent path of nodes

func (*BadExpr) Pkg

func (s *BadExpr) Pkg() *Package

Pkg returns the package this node belongs to.

func (*BadExpr) Siblings

func (s *BadExpr) Siblings() []Node

Siblings returns all sibling nodes

func (*BadExpr) TreeNode

func (s *BadExpr) TreeNode(cond func(n Node) bool) Node

TreeNode walks the child tree returning the first node that meets the condition

func (*BadExpr) TreeNodes

func (s *BadExpr) TreeNodes(cond func(n Node) bool) []Node

TreeNodes walks the child tree collecting all nodes that meet the condition

func (*BadExpr) ValueType

func (s *BadExpr) ValueType() types.Type

ValueType returns value type information of an expression, nil otherwise

func (*BadExpr) Visit

func (s *BadExpr) Visit(node ast.Node) ast.Visitor

Visit implements the ast.Visitor interface and is used to walk the underlying ast.Node tree

func (*BadExpr) Walk

func (s *BadExpr) Walk(f func(node Node) bool)

Walk traverses the tree and its children. return false to skip children of the current element

type BadStmt

type BadStmt struct {
	*ast.BadStmt
	// contains filtered or unexported fields
}

BadStmt wraps ast.BadStmt

func (*BadStmt) AstNode

func (s *BadStmt) AstNode() ast.Node

AstNode returns the original ast.Node

func (BadStmt) CallTreeNode

func (s BadStmt) CallTreeNode(cond func(n Node) bool) Node

CallTreeNode walks the call tree returning the first node that meets the condition

func (BadStmt) CallTreeNodes

func (s BadStmt) CallTreeNodes(cond func(n Node) bool) []Node

CallTreeNodes walks the call tree collecting all nodes that meet the condition

func (*BadStmt) ChildByName

func (s *BadStmt) ChildByName(name string) Node

ChildByName retrieves a node among the direkt children by name (only nodes that have a name)

func (*BadStmt) ChildByNodeType

func (s *BadStmt) ChildByNodeType(nodeType NodeType) Node

ChildByNodeType returns the first child of a certain type.

func (*BadStmt) ChildNode

func (s *BadStmt) ChildNode(cond func(n Node) bool) Node

ChildNode walks only child nodes returning the first node that meets the condition

func (*BadStmt) ChildNodes

func (s *BadStmt) ChildNodes(cond func(n Node) bool) []Node

ChildNodes walks only child nodes collecting all nodes that meet the condition

func (*BadStmt) Children

func (s *BadStmt) Children() []Node

Children returns all child nodes

func (*BadStmt) ChildrenByNodeType

func (s *BadStmt) ChildrenByNodeType(nodeType NodeType) []Node

ChildrenByNodeType returns the first child of a certain type.

func (*BadStmt) Contains

func (s *BadStmt) Contains(node Node) bool

Contains checks if a node contains another node

func (*BadStmt) FindByName

func (s *BadStmt) FindByName(name string) []Node

FindByName looks for a name in the entire sub tree

func (*BadStmt) FindByNodeType

func (s *BadStmt) FindByNodeType(nodeType NodeType) []Node

FindByNodeType returns all sub nodes of a certain type

func (*BadStmt) FindByToken

func (s *BadStmt) FindByToken(t token.Token) []Node

FindByToken finds a node with a token.Token attached and of given token type

func (*BadStmt) FindByValueType

func (s *BadStmt) FindByValueType(valType string) []Node

FindByValueType find all nodes with given value type

func (*BadStmt) FindDeclarations

func (s *BadStmt) FindDeclarations() []*Ident

FindDeclarations finds all declarations

func (*BadStmt) FindDeclarationsByType

func (s *BadStmt) FindDeclarationsByType(nodeType NodeType) []*Ident

FindDeclarationsByType finds all declarations by (parent) type

func (*BadStmt) FindFirstByName

func (s *BadStmt) FindFirstByName(name string) Node

FindFirstByName looks for a name in the entire sub tree. First node is returned if there are multiple.

func (*BadStmt) FindFirstByNodeType

func (s *BadStmt) FindFirstByNodeType(nodeType NodeType) Node

FindFirstByNodeType returns the first sub node of a certain type

func (*BadStmt) FindFirstIdentByName

func (s *BadStmt) FindFirstIdentByName(name string) *Ident

FindFirstIdentByName looks for the first Ident node in subtree with given name

func (*BadStmt) FindFirstUsage

func (s *BadStmt) FindFirstUsage(declaration *Ident) *Ident

FindFirstUsage selects the first usage

func (*BadStmt) FindIdentByName

func (s *BadStmt) FindIdentByName(name string) []*Ident

FindIdentByName looks for Ident nodes in the entire sub tree with given name

func (*BadStmt) FindMaps

func (s *BadStmt) FindMaps() []Node

FindMaps find all nodes with given value type

func (*BadStmt) FindNameInCallTree

func (s *BadStmt) FindNameInCallTree(name string) []Node

FindNameInCallTree returns all nodes in call tree with given name

func (*BadStmt) FindNodeTypeInCallTree

func (s *BadStmt) FindNodeTypeInCallTree(nodeType NodeType) []Node

FindNodeTypeInCallTree returns all nodes in call tree of a certain type

func (*BadStmt) FindUsages

func (s *BadStmt) FindUsages(declaration *Ident) []*Ident

FindUsages finds usages of given declaration

func (*BadStmt) FindVarDeclarations

func (s *BadStmt) FindVarDeclarations() []*Ident

FindVarDeclarations finds all assignStmt (:=), valueSpec (var, const) declarations

func (*BadStmt) GetScope

func (s *BadStmt) GetScope() (Node, *types.Scope)

GetScope returns the scope of the node

func (*BadStmt) GetSource

func (s *BadStmt) GetSource() []byte

GetSource returns the source code of the current node

func (*BadStmt) GetSourceString

func (s *BadStmt) GetSourceString() string

GetSourceString is a convenience function to GetSource as string

func (*BadStmt) Info

func (s *BadStmt) Info() *types.Info

Info returns the types.info node.

func (*BadStmt) IsContainedByType

func (s *BadStmt) IsContainedByType(nodeType NodeType) bool

IsContainedByType checks if node is contained by a node of given node type

func (*BadStmt) IsNodeType

func (s *BadStmt) IsNodeType(nodeType NodeType) bool

IsNodeType checks if node is of given node type

func (*BadStmt) IsValueType

func (s *BadStmt) IsValueType(valType string) bool

IsValueType checks if value type is of given type

func (*BadStmt) Level

func (s *BadStmt) Level() int

Level returns the level counted from instantiated node = 0

func (*BadStmt) Match

func (s *BadStmt) Match(regex regexp.Regexp) bool

Match matches the source code of current node and content with given regex

func (*BadStmt) NextParentByType

func (s *BadStmt) NextParentByType(nodeType NodeType) Node

NextParentByType returns the next parent of given type

func (*BadStmt) NodeType

func (s *BadStmt) NodeType() NodeType

NodeType returns the NodeType of the node

func (*BadStmt) Object

func (s *BadStmt) Object() types.Object

Object returns the object of an identifier, nil otherwise

func (*BadStmt) Parent

func (s *BadStmt) Parent() Node

Parent return the parent node

func (*BadStmt) Parents

func (s *BadStmt) Parents() []Node

Parents returns the parent path of nodes

func (*BadStmt) Pkg

func (s *BadStmt) Pkg() *Package

Pkg returns the package this node belongs to.

func (*BadStmt) Siblings

func (s *BadStmt) Siblings() []Node

Siblings returns all sibling nodes

func (*BadStmt) TreeNode

func (s *BadStmt) TreeNode(cond func(n Node) bool) Node

TreeNode walks the child tree returning the first node that meets the condition

func (*BadStmt) TreeNodes

func (s *BadStmt) TreeNodes(cond func(n Node) bool) []Node

TreeNodes walks the child tree collecting all nodes that meet the condition

func (*BadStmt) ValueType

func (s *BadStmt) ValueType() types.Type

ValueType returns value type information of an expression, nil otherwise

func (*BadStmt) Visit

func (s *BadStmt) Visit(node ast.Node) ast.Visitor

Visit implements the ast.Visitor interface and is used to walk the underlying ast.Node tree

func (*BadStmt) Walk

func (s *BadStmt) Walk(f func(node Node) bool)

Walk traverses the tree and its children. return false to skip children of the current element

type BasicLit

type BasicLit struct {
	*ast.BasicLit
	// contains filtered or unexported fields
}

BasicLit wraps ast.BasicLit

func (*BasicLit) AstNode

func (s *BasicLit) AstNode() ast.Node

AstNode returns the original ast.Node

func (BasicLit) CallTreeNode

func (s BasicLit) CallTreeNode(cond func(n Node) bool) Node

CallTreeNode walks the call tree returning the first node that meets the condition

func (BasicLit) CallTreeNodes

func (s BasicLit) CallTreeNodes(cond func(n Node) bool) []Node

CallTreeNodes walks the call tree collecting all nodes that meet the condition

func (*BasicLit) ChildByName

func (s *BasicLit) ChildByName(name string) Node

ChildByName retrieves a node among the direkt children by name (only nodes that have a name)

func (*BasicLit) ChildByNodeType

func (s *BasicLit) ChildByNodeType(nodeType NodeType) Node

ChildByNodeType returns the first child of a certain type.

func (*BasicLit) ChildNode

func (s *BasicLit) ChildNode(cond func(n Node) bool) Node

ChildNode walks only child nodes returning the first node that meets the condition

func (*BasicLit) ChildNodes

func (s *BasicLit) ChildNodes(cond func(n Node) bool) []Node

ChildNodes walks only child nodes collecting all nodes that meet the condition

func (*BasicLit) Children

func (s *BasicLit) Children() []Node

Children returns all child nodes

func (*BasicLit) ChildrenByNodeType

func (s *BasicLit) ChildrenByNodeType(nodeType NodeType) []Node

ChildrenByNodeType returns the first child of a certain type.

func (*BasicLit) Contains

func (s *BasicLit) Contains(node Node) bool

Contains checks if a node contains another node

func (*BasicLit) FindByName

func (s *BasicLit) FindByName(name string) []Node

FindByName looks for a name in the entire sub tree

func (*BasicLit) FindByNodeType

func (s *BasicLit) FindByNodeType(nodeType NodeType) []Node

FindByNodeType returns all sub nodes of a certain type

func (*BasicLit) FindByToken

func (s *BasicLit) FindByToken(t token.Token) []Node

FindByToken finds a node with a token.Token attached and of given token type

func (*BasicLit) FindByValueType

func (s *BasicLit) FindByValueType(valType string) []Node

FindByValueType find all nodes with given value type

func (*BasicLit) FindDeclarations

func (s *BasicLit) FindDeclarations() []*Ident

FindDeclarations finds all declarations

func (*BasicLit) FindDeclarationsByType

func (s *BasicLit) FindDeclarationsByType(nodeType NodeType) []*Ident

FindDeclarationsByType finds all declarations by (parent) type

func (*BasicLit) FindFirstByName

func (s *BasicLit) FindFirstByName(name string) Node

FindFirstByName looks for a name in the entire sub tree. First node is returned if there are multiple.

func (*BasicLit) FindFirstByNodeType

func (s *BasicLit) FindFirstByNodeType(nodeType NodeType) Node

FindFirstByNodeType returns the first sub node of a certain type

func (*BasicLit) FindFirstIdentByName

func (s *BasicLit) FindFirstIdentByName(name string) *Ident

FindFirstIdentByName looks for the first Ident node in subtree with given name

func (*BasicLit) FindFirstUsage

func (s *BasicLit) FindFirstUsage(declaration *Ident) *Ident

FindFirstUsage selects the first usage

func (*BasicLit) FindIdentByName

func (s *BasicLit) FindIdentByName(name string) []*Ident

FindIdentByName looks for Ident nodes in the entire sub tree with given name

func (*BasicLit) FindMaps

func (s *BasicLit) FindMaps() []Node

FindMaps find all nodes with given value type

func (*BasicLit) FindNameInCallTree

func (s *BasicLit) FindNameInCallTree(name string) []Node

FindNameInCallTree returns all nodes in call tree with given name

func (*BasicLit) FindNodeTypeInCallTree

func (s *BasicLit) FindNodeTypeInCallTree(nodeType NodeType) []Node

FindNodeTypeInCallTree returns all nodes in call tree of a certain type

func (*BasicLit) FindUsages

func (s *BasicLit) FindUsages(declaration *Ident) []*Ident

FindUsages finds usages of given declaration

func (*BasicLit) FindVarDeclarations

func (s *BasicLit) FindVarDeclarations() []*Ident

FindVarDeclarations finds all assignStmt (:=), valueSpec (var, const) declarations

func (*BasicLit) GetScope

func (s *BasicLit) GetScope() (Node, *types.Scope)

GetScope returns the scope of the node

func (*BasicLit) GetSource

func (s *BasicLit) GetSource() []byte

GetSource returns the source code of the current node

func (*BasicLit) GetSourceString

func (s *BasicLit) GetSourceString() string

GetSourceString is a convenience function to GetSource as string

func (*BasicLit) Info

func (s *BasicLit) Info() *types.Info

Info returns the types.info node.

func (*BasicLit) IsContainedByType

func (s *BasicLit) IsContainedByType(nodeType NodeType) bool

IsContainedByType checks if node is contained by a node of given node type

func (*BasicLit) IsNodeType

func (s *BasicLit) IsNodeType(nodeType NodeType) bool

IsNodeType checks if node is of given node type

func (*BasicLit) IsValueType

func (s *BasicLit) IsValueType(valType string) bool

IsValueType checks if value type is of given type

func (*BasicLit) Level

func (s *BasicLit) Level() int

Level returns the level counted from instantiated node = 0

func (*BasicLit) Match

func (s *BasicLit) Match(regex regexp.Regexp) bool

Match matches the source code of current node and content with given regex

func (*BasicLit) NextParentByType

func (s *BasicLit) NextParentByType(nodeType NodeType) Node

NextParentByType returns the next parent of given type

func (*BasicLit) NodeType

func (s *BasicLit) NodeType() NodeType

NodeType returns the NodeType of the node

func (*BasicLit) Object

func (s *BasicLit) Object() types.Object

Object returns the object of an identifier, nil otherwise

func (*BasicLit) Parent

func (s *BasicLit) Parent() Node

Parent return the parent node

func (*BasicLit) Parents

func (s *BasicLit) Parents() []Node

Parents returns the parent path of nodes

func (*BasicLit) Pkg

func (s *BasicLit) Pkg() *Package

Pkg returns the package this node belongs to.

func (*BasicLit) Siblings

func (s *BasicLit) Siblings() []Node

Siblings returns all sibling nodes

func (*BasicLit) Token

func (s *BasicLit) Token() token.Token

Token returns the token of the node

func (*BasicLit) TreeNode

func (s *BasicLit) TreeNode(cond func(n Node) bool) Node

TreeNode walks the child tree returning the first node that meets the condition

func (*BasicLit) TreeNodes

func (s *BasicLit) TreeNodes(cond func(n Node) bool) []Node

TreeNodes walks the child tree collecting all nodes that meet the condition

func (*BasicLit) ValueType

func (s *BasicLit) ValueType() types.Type

ValueType returns value type information of an expression, nil otherwise

func (*BasicLit) Visit

func (s *BasicLit) Visit(node ast.Node) ast.Visitor

Visit implements the ast.Visitor interface and is used to walk the underlying ast.Node tree

func (*BasicLit) Walk

func (s *BasicLit) Walk(f func(node Node) bool)

Walk traverses the tree and its children. return false to skip children of the current element

type BinaryExpr

type BinaryExpr struct {
	*ast.BinaryExpr
	// contains filtered or unexported fields
}

BinaryExpr wraps ast.BinaryExpr

func (*BinaryExpr) AstNode

func (s *BinaryExpr) AstNode() ast.Node

AstNode returns the original ast.Node

func (BinaryExpr) CallTreeNode

func (s BinaryExpr) CallTreeNode(cond func(n Node) bool) Node

CallTreeNode walks the call tree returning the first node that meets the condition

func (BinaryExpr) CallTreeNodes

func (s BinaryExpr) CallTreeNodes(cond func(n Node) bool) []Node

CallTreeNodes walks the call tree collecting all nodes that meet the condition

func (*BinaryExpr) ChildByName

func (s *BinaryExpr) ChildByName(name string) Node

ChildByName retrieves a node among the direkt children by name (only nodes that have a name)

func (*BinaryExpr) ChildByNodeType

func (s *BinaryExpr) ChildByNodeType(nodeType NodeType) Node

ChildByNodeType returns the first child of a certain type.

func (*BinaryExpr) ChildNode

func (s *BinaryExpr) ChildNode(cond func(n Node) bool) Node

ChildNode walks only child nodes returning the first node that meets the condition

func (*BinaryExpr) ChildNodes

func (s *BinaryExpr) ChildNodes(cond func(n Node) bool) []Node

ChildNodes walks only child nodes collecting all nodes that meet the condition

func (*BinaryExpr) Children

func (s *BinaryExpr) Children() []Node

Children returns all child nodes

func (*BinaryExpr) ChildrenByNodeType

func (s *BinaryExpr) ChildrenByNodeType(nodeType NodeType) []Node

ChildrenByNodeType returns the first child of a certain type.

func (*BinaryExpr) Contains

func (s *BinaryExpr) Contains(node Node) bool

Contains checks if a node contains another node

func (*BinaryExpr) FindByName

func (s *BinaryExpr) FindByName(name string) []Node

FindByName looks for a name in the entire sub tree

func (*BinaryExpr) FindByNodeType

func (s *BinaryExpr) FindByNodeType(nodeType NodeType) []Node

FindByNodeType returns all sub nodes of a certain type

func (*BinaryExpr) FindByToken

func (s *BinaryExpr) FindByToken(t token.Token) []Node

FindByToken finds a node with a token.Token attached and of given token type

func (*BinaryExpr) FindByValueType

func (s *BinaryExpr) FindByValueType(valType string) []Node

FindByValueType find all nodes with given value type

func (*BinaryExpr) FindDeclarations

func (s *BinaryExpr) FindDeclarations() []*Ident

FindDeclarations finds all declarations

func (*BinaryExpr) FindDeclarationsByType

func (s *BinaryExpr) FindDeclarationsByType(nodeType NodeType) []*Ident

FindDeclarationsByType finds all declarations by (parent) type

func (*BinaryExpr) FindFirstByName

func (s *BinaryExpr) FindFirstByName(name string) Node

FindFirstByName looks for a name in the entire sub tree. First node is returned if there are multiple.

func (*BinaryExpr) FindFirstByNodeType

func (s *BinaryExpr) FindFirstByNodeType(nodeType NodeType) Node

FindFirstByNodeType returns the first sub node of a certain type

func (*BinaryExpr) FindFirstIdentByName

func (s *BinaryExpr) FindFirstIdentByName(name string) *Ident

FindFirstIdentByName looks for the first Ident node in subtree with given name

func (*BinaryExpr) FindFirstUsage

func (s *BinaryExpr) FindFirstUsage(declaration *Ident) *Ident

FindFirstUsage selects the first usage

func (*BinaryExpr) FindIdentByName

func (s *BinaryExpr) FindIdentByName(name string) []*Ident

FindIdentByName looks for Ident nodes in the entire sub tree with given name

func (*BinaryExpr) FindMaps

func (s *BinaryExpr) FindMaps() []Node

FindMaps find all nodes with given value type

func (*BinaryExpr) FindNameInCallTree

func (s *BinaryExpr) FindNameInCallTree(name string) []Node

FindNameInCallTree returns all nodes in call tree with given name

func (*BinaryExpr) FindNodeTypeInCallTree

func (s *BinaryExpr) FindNodeTypeInCallTree(nodeType NodeType) []Node

FindNodeTypeInCallTree returns all nodes in call tree of a certain type

func (*BinaryExpr) FindUsages

func (s *BinaryExpr) FindUsages(declaration *Ident) []*Ident

FindUsages finds usages of given declaration

func (*BinaryExpr) FindVarDeclarations

func (s *BinaryExpr) FindVarDeclarations() []*Ident

FindVarDeclarations finds all assignStmt (:=), valueSpec (var, const) declarations

func (*BinaryExpr) GetScope

func (s *BinaryExpr) GetScope() (Node, *types.Scope)

GetScope returns the scope of the node

func (*BinaryExpr) GetSource

func (s *BinaryExpr) GetSource() []byte

GetSource returns the source code of the current node

func (*BinaryExpr) GetSourceString

func (s *BinaryExpr) GetSourceString() string

GetSourceString is a convenience function to GetSource as string

func (*BinaryExpr) Info

func (s *BinaryExpr) Info() *types.Info

Info returns the types.info node.

func (*BinaryExpr) IsContainedByType

func (s *BinaryExpr) IsContainedByType(nodeType NodeType) bool

IsContainedByType checks if node is contained by a node of given node type

func (*BinaryExpr) IsNodeType

func (s *BinaryExpr) IsNodeType(nodeType NodeType) bool

IsNodeType checks if node is of given node type

func (*BinaryExpr) IsValueType

func (s *BinaryExpr) IsValueType(valType string) bool

IsValueType checks if value type is of given type

func (*BinaryExpr) Level

func (s *BinaryExpr) Level() int

Level returns the level counted from instantiated node = 0

func (*BinaryExpr) Match

func (s *BinaryExpr) Match(regex regexp.Regexp) bool

Match matches the source code of current node and content with given regex

func (*BinaryExpr) NextParentByType

func (s *BinaryExpr) NextParentByType(nodeType NodeType) Node

NextParentByType returns the next parent of given type

func (*BinaryExpr) NodeType

func (s *BinaryExpr) NodeType() NodeType

NodeType returns the NodeType of the node

func (*BinaryExpr) Object

func (s *BinaryExpr) Object() types.Object

Object returns the object of an identifier, nil otherwise

func (*BinaryExpr) Parent

func (s *BinaryExpr) Parent() Node

Parent return the parent node

func (*BinaryExpr) Parents

func (s *BinaryExpr) Parents() []Node

Parents returns the parent path of nodes

func (*BinaryExpr) Pkg

func (s *BinaryExpr) Pkg() *Package

Pkg returns the package this node belongs to.

func (*BinaryExpr) Siblings

func (s *BinaryExpr) Siblings() []Node

Siblings returns all sibling nodes

func (*BinaryExpr) Token

func (s *BinaryExpr) Token() token.Token

Token returns the token of the node

func (*BinaryExpr) TreeNode

func (s *BinaryExpr) TreeNode(cond func(n Node) bool) Node

TreeNode walks the child tree returning the first node that meets the condition

func (*BinaryExpr) TreeNodes

func (s *BinaryExpr) TreeNodes(cond func(n Node) bool) []Node

TreeNodes walks the child tree collecting all nodes that meet the condition

func (*BinaryExpr) ValueType

func (s *BinaryExpr) ValueType() types.Type

ValueType returns value type information of an expression, nil otherwise

func (*BinaryExpr) Visit

func (s *BinaryExpr) Visit(node ast.Node) ast.Visitor

Visit implements the ast.Visitor interface and is used to walk the underlying ast.Node tree

func (*BinaryExpr) Walk

func (s *BinaryExpr) Walk(f func(node Node) bool)

Walk traverses the tree and its children. return false to skip children of the current element

func (*BinaryExpr) X

func (s *BinaryExpr) X() Node

X returns left hand side nodes

func (*BinaryExpr) Y

func (s *BinaryExpr) Y() Node

Y returns left hand side nodes

type BlockStmt

type BlockStmt struct {
	*ast.BlockStmt
	// contains filtered or unexported fields
}

BlockStmt wraps ast.BlockStmt

func (*BlockStmt) AstNode

func (s *BlockStmt) AstNode() ast.Node

AstNode returns the original ast.Node

func (BlockStmt) CallTreeNode

func (s BlockStmt) CallTreeNode(cond func(n Node) bool) Node

CallTreeNode walks the call tree returning the first node that meets the condition

func (BlockStmt) CallTreeNodes

func (s BlockStmt) CallTreeNodes(cond func(n Node) bool) []Node

CallTreeNodes walks the call tree collecting all nodes that meet the condition

func (*BlockStmt) ChildByName

func (s *BlockStmt) ChildByName(name string) Node

ChildByName retrieves a node among the direkt children by name (only nodes that have a name)

func (*BlockStmt) ChildByNodeType

func (s *BlockStmt) ChildByNodeType(nodeType NodeType) Node

ChildByNodeType returns the first child of a certain type.

func (*BlockStmt) ChildNode

func (s *BlockStmt) ChildNode(cond func(n Node) bool) Node

ChildNode walks only child nodes returning the first node that meets the condition

func (*BlockStmt) ChildNodes

func (s *BlockStmt) ChildNodes(cond func(n Node) bool) []Node

ChildNodes walks only child nodes collecting all nodes that meet the condition

func (*BlockStmt) Children

func (s *BlockStmt) Children() []Node

Children returns all child nodes

func (*BlockStmt) ChildrenByNodeType

func (s *BlockStmt) ChildrenByNodeType(nodeType NodeType) []Node

ChildrenByNodeType returns the first child of a certain type.

func (*BlockStmt) Contains

func (s *BlockStmt) Contains(node Node) bool

Contains checks if a node contains another node

func (*BlockStmt) FindByName

func (s *BlockStmt) FindByName(name string) []Node

FindByName looks for a name in the entire sub tree

func (*BlockStmt) FindByNodeType

func (s *BlockStmt) FindByNodeType(nodeType NodeType) []Node

FindByNodeType returns all sub nodes of a certain type

func (*BlockStmt) FindByToken

func (s *BlockStmt) FindByToken(t token.Token) []Node

FindByToken finds a node with a token.Token attached and of given token type

func (*BlockStmt) FindByValueType

func (s *BlockStmt) FindByValueType(valType string) []Node

FindByValueType find all nodes with given value type

func (*BlockStmt) FindDeclarations

func (s *BlockStmt) FindDeclarations() []*Ident

FindDeclarations finds all declarations

func (*BlockStmt) FindDeclarationsByType

func (s *BlockStmt) FindDeclarationsByType(nodeType NodeType) []*Ident

FindDeclarationsByType finds all declarations by (parent) type

func (*BlockStmt) FindFirstByName

func (s *BlockStmt) FindFirstByName(name string) Node

FindFirstByName looks for a name in the entire sub tree. First node is returned if there are multiple.

func (*BlockStmt) FindFirstByNodeType

func (s *BlockStmt) FindFirstByNodeType(nodeType NodeType) Node

FindFirstByNodeType returns the first sub node of a certain type

func (*BlockStmt) FindFirstIdentByName

func (s *BlockStmt) FindFirstIdentByName(name string) *Ident

FindFirstIdentByName looks for the first Ident node in subtree with given name

func (*BlockStmt) FindFirstUsage

func (s *BlockStmt) FindFirstUsage(declaration *Ident) *Ident

FindFirstUsage selects the first usage

func (*BlockStmt) FindIdentByName

func (s *BlockStmt) FindIdentByName(name string) []*Ident

FindIdentByName looks for Ident nodes in the entire sub tree with given name

func (*BlockStmt) FindMaps

func (s *BlockStmt) FindMaps() []Node

FindMaps find all nodes with given value type

func (*BlockStmt) FindNameInCallTree

func (s *BlockStmt) FindNameInCallTree(name string) []Node

FindNameInCallTree returns all nodes in call tree with given name

func (*BlockStmt) FindNodeTypeInCallTree

func (s *BlockStmt) FindNodeTypeInCallTree(nodeType NodeType) []Node

FindNodeTypeInCallTree returns all nodes in call tree of a certain type

func (*BlockStmt) FindUsages

func (s *BlockStmt) FindUsages(declaration *Ident) []*Ident

FindUsages finds usages of given declaration

func (*BlockStmt) FindVarDeclarations

func (s *BlockStmt) FindVarDeclarations() []*Ident

FindVarDeclarations finds all assignStmt (:=), valueSpec (var, const) declarations

func (*BlockStmt) GetScope

func (s *BlockStmt) GetScope() (Node, *types.Scope)

GetScope returns the scope of the node

func (*BlockStmt) GetSource

func (s *BlockStmt) GetSource() []byte

GetSource returns the source code of the current node

func (*BlockStmt) GetSourceString

func (s *BlockStmt) GetSourceString() string

GetSourceString is a convenience function to GetSource as string

func (*BlockStmt) Info

func (s *BlockStmt) Info() *types.Info

Info returns the types.info node.

func (*BlockStmt) IsContainedByType

func (s *BlockStmt) IsContainedByType(nodeType NodeType) bool

IsContainedByType checks if node is contained by a node of given node type

func (*BlockStmt) IsNodeType

func (s *BlockStmt) IsNodeType(nodeType NodeType) bool

IsNodeType checks if node is of given node type

func (*BlockStmt) IsValueType

func (s *BlockStmt) IsValueType(valType string) bool

IsValueType checks if value type is of given type

func (*BlockStmt) Level

func (s *BlockStmt) Level() int

Level returns the level counted from instantiated node = 0

func (*BlockStmt) Match

func (s *BlockStmt) Match(regex regexp.Regexp) bool

Match matches the source code of current node and content with given regex

func (*BlockStmt) NextParentByType

func (s *BlockStmt) NextParentByType(nodeType NodeType) Node

NextParentByType returns the next parent of given type

func (*BlockStmt) NodeType

func (s *BlockStmt) NodeType() NodeType

NodeType returns the NodeType of the node

func (*BlockStmt) Object

func (s *BlockStmt) Object() types.Object

Object returns the object of an identifier, nil otherwise

func (*BlockStmt) Parent

func (s *BlockStmt) Parent() Node

Parent return the parent node

func (*BlockStmt) Parents

func (s *BlockStmt) Parents() []Node

Parents returns the parent path of nodes

func (*BlockStmt) Pkg

func (s *BlockStmt) Pkg() *Package

Pkg returns the package this node belongs to.

func (*BlockStmt) Siblings

func (s *BlockStmt) Siblings() []Node

Siblings returns all sibling nodes

func (*BlockStmt) TreeNode

func (s *BlockStmt) TreeNode(cond func(n Node) bool) Node

TreeNode walks the child tree returning the first node that meets the condition

func (*BlockStmt) TreeNodes

func (s *BlockStmt) TreeNodes(cond func(n Node) bool) []Node

TreeNodes walks the child tree collecting all nodes that meet the condition

func (*BlockStmt) ValueType

func (s *BlockStmt) ValueType() types.Type

ValueType returns value type information of an expression, nil otherwise

func (*BlockStmt) Visit

func (s *BlockStmt) Visit(node ast.Node) ast.Visitor

Visit implements the ast.Visitor interface and is used to walk the underlying ast.Node tree

func (*BlockStmt) Walk

func (s *BlockStmt) Walk(f func(node Node) bool)

Walk traverses the tree and its children. return false to skip children of the current element

type BranchStmt

type BranchStmt struct {
	*ast.BranchStmt
	// contains filtered or unexported fields
}

BranchStmt wraps ast.BranchStmt

func (*BranchStmt) AstNode

func (s *BranchStmt) AstNode() ast.Node

AstNode returns the original ast.Node

func (BranchStmt) CallTreeNode

func (s BranchStmt) CallTreeNode(cond func(n Node) bool) Node

CallTreeNode walks the call tree returning the first node that meets the condition

func (BranchStmt) CallTreeNodes

func (s BranchStmt) CallTreeNodes(cond func(n Node) bool) []Node

CallTreeNodes walks the call tree collecting all nodes that meet the condition

func (*BranchStmt) ChildByName

func (s *BranchStmt) ChildByName(name string) Node

ChildByName retrieves a node among the direkt children by name (only nodes that have a name)

func (*BranchStmt) ChildByNodeType

func (s *BranchStmt) ChildByNodeType(nodeType NodeType) Node

ChildByNodeType returns the first child of a certain type.

func (*BranchStmt) ChildNode

func (s *BranchStmt) ChildNode(cond func(n Node) bool) Node

ChildNode walks only child nodes returning the first node that meets the condition

func (*BranchStmt) ChildNodes

func (s *BranchStmt) ChildNodes(cond func(n Node) bool) []Node

ChildNodes walks only child nodes collecting all nodes that meet the condition

func (*BranchStmt) Children

func (s *BranchStmt) Children() []Node

Children returns all child nodes

func (*BranchStmt) ChildrenByNodeType

func (s *BranchStmt) ChildrenByNodeType(nodeType NodeType) []Node

ChildrenByNodeType returns the first child of a certain type.

func (*BranchStmt) Contains

func (s *BranchStmt) Contains(node Node) bool

Contains checks if a node contains another node

func (*BranchStmt) FindByName

func (s *BranchStmt) FindByName(name string) []Node

FindByName looks for a name in the entire sub tree

func (*BranchStmt) FindByNodeType

func (s *BranchStmt) FindByNodeType(nodeType NodeType) []Node

FindByNodeType returns all sub nodes of a certain type

func (*BranchStmt) FindByToken

func (s *BranchStmt) FindByToken(t token.Token) []Node

FindByToken finds a node with a token.Token attached and of given token type

func (*BranchStmt) FindByValueType

func (s *BranchStmt) FindByValueType(valType string) []Node

FindByValueType find all nodes with given value type

func (*BranchStmt) FindDeclarations

func (s *BranchStmt) FindDeclarations() []*Ident

FindDeclarations finds all declarations

func (*BranchStmt) FindDeclarationsByType

func (s *BranchStmt) FindDeclarationsByType(nodeType NodeType) []*Ident

FindDeclarationsByType finds all declarations by (parent) type

func (*BranchStmt) FindFirstByName

func (s *BranchStmt) FindFirstByName(name string) Node

FindFirstByName looks for a name in the entire sub tree. First node is returned if there are multiple.

func (*BranchStmt) FindFirstByNodeType

func (s *BranchStmt) FindFirstByNodeType(nodeType NodeType) Node

FindFirstByNodeType returns the first sub node of a certain type

func (*BranchStmt) FindFirstIdentByName

func (s *BranchStmt) FindFirstIdentByName(name string) *Ident

FindFirstIdentByName looks for the first Ident node in subtree with given name

func (*BranchStmt) FindFirstUsage

func (s *BranchStmt) FindFirstUsage(declaration *Ident) *Ident

FindFirstUsage selects the first usage

func (*BranchStmt) FindIdentByName

func (s *BranchStmt) FindIdentByName(name string) []*Ident

FindIdentByName looks for Ident nodes in the entire sub tree with given name

func (*BranchStmt) FindMaps

func (s *BranchStmt) FindMaps() []Node

FindMaps find all nodes with given value type

func (*BranchStmt) FindNameInCallTree

func (s *BranchStmt) FindNameInCallTree(name string) []Node

FindNameInCallTree returns all nodes in call tree with given name

func (*BranchStmt) FindNodeTypeInCallTree

func (s *BranchStmt) FindNodeTypeInCallTree(nodeType NodeType) []Node

FindNodeTypeInCallTree returns all nodes in call tree of a certain type

func (*BranchStmt) FindUsages

func (s *BranchStmt) FindUsages(declaration *Ident) []*Ident

FindUsages finds usages of given declaration

func (*BranchStmt) FindVarDeclarations

func (s *BranchStmt) FindVarDeclarations() []*Ident

FindVarDeclarations finds all assignStmt (:=), valueSpec (var, const) declarations

func (*BranchStmt) GetIdent

func (s *BranchStmt) GetIdent() *Ident

GetIdent returns the name of the node

func (*BranchStmt) GetScope

func (s *BranchStmt) GetScope() (Node, *types.Scope)

GetScope returns the scope of the node

func (*BranchStmt) GetSource

func (s *BranchStmt) GetSource() []byte

GetSource returns the source code of the current node

func (*BranchStmt) GetSourceString

func (s *BranchStmt) GetSourceString() string

GetSourceString is a convenience function to GetSource as string

func (*BranchStmt) Info

func (s *BranchStmt) Info() *types.Info

Info returns the types.info node.

func (*BranchStmt) IsContainedByType

func (s *BranchStmt) IsContainedByType(nodeType NodeType) bool

IsContainedByType checks if node is contained by a node of given node type

func (*BranchStmt) IsNodeType

func (s *BranchStmt) IsNodeType(nodeType NodeType) bool

IsNodeType checks if node is of given node type

func (*BranchStmt) IsValueType

func (s *BranchStmt) IsValueType(valType string) bool

IsValueType checks if value type is of given type

func (*BranchStmt) Level

func (s *BranchStmt) Level() int

Level returns the level counted from instantiated node = 0

func (*BranchStmt) Match

func (s *BranchStmt) Match(regex regexp.Regexp) bool

Match matches the source code of current node and content with given regex

func (*BranchStmt) NextParentByType

func (s *BranchStmt) NextParentByType(nodeType NodeType) Node

NextParentByType returns the next parent of given type

func (*BranchStmt) NodeName

func (s *BranchStmt) NodeName() string

NodeName returns the name of the node

func (*BranchStmt) NodeType

func (s *BranchStmt) NodeType() NodeType

NodeType returns the NodeType of the node

func (*BranchStmt) Object

func (s *BranchStmt) Object() types.Object

Object returns the object of an identifier, nil otherwise

func (*BranchStmt) Parent

func (s *BranchStmt) Parent() Node

Parent return the parent node

func (*BranchStmt) Parents

func (s *BranchStmt) Parents() []Node

Parents returns the parent path of nodes

func (*BranchStmt) Pkg

func (s *BranchStmt) Pkg() *Package

Pkg returns the package this node belongs to.

func (*BranchStmt) Siblings

func (s *BranchStmt) Siblings() []Node

Siblings returns all sibling nodes

func (*BranchStmt) Token

func (s *BranchStmt) Token() token.Token

Token returns the token of the node

func (*BranchStmt) TreeNode

func (s *BranchStmt) TreeNode(cond func(n Node) bool) Node

TreeNode walks the child tree returning the first node that meets the condition

func (*BranchStmt) TreeNodes

func (s *BranchStmt) TreeNodes(cond func(n Node) bool) []Node

TreeNodes walks the child tree collecting all nodes that meet the condition

func (*BranchStmt) ValueType

func (s *BranchStmt) ValueType() types.Type

ValueType returns value type information of an expression, nil otherwise

func (*BranchStmt) Visit

func (s *BranchStmt) Visit(node ast.Node) ast.Visitor

Visit implements the ast.Visitor interface and is used to walk the underlying ast.Node tree

func (*BranchStmt) Walk

func (s *BranchStmt) Walk(f func(node Node) bool)

Walk traverses the tree and its children. return false to skip children of the current element

type CallExpr

type CallExpr struct {
	*ast.CallExpr
	// contains filtered or unexported fields
}

CallExpr wraps ast.CallExpr

func (*CallExpr) AstNode

func (s *CallExpr) AstNode() ast.Node

AstNode returns the original ast.Node

func (CallExpr) CallTreeNode

func (s CallExpr) CallTreeNode(cond func(n Node) bool) Node

CallTreeNode walks the call tree returning the first node that meets the condition

func (CallExpr) CallTreeNodes

func (s CallExpr) CallTreeNodes(cond func(n Node) bool) []Node

CallTreeNodes walks the call tree collecting all nodes that meet the condition

func (*CallExpr) ChildByName

func (s *CallExpr) ChildByName(name string) Node

ChildByName retrieves a node among the direkt children by name (only nodes that have a name)

func (*CallExpr) ChildByNodeType

func (s *CallExpr) ChildByNodeType(nodeType NodeType) Node

ChildByNodeType returns the first child of a certain type.

func (*CallExpr) ChildNode

func (s *CallExpr) ChildNode(cond func(n Node) bool) Node

ChildNode walks only child nodes returning the first node that meets the condition

func (*CallExpr) ChildNodes

func (s *CallExpr) ChildNodes(cond func(n Node) bool) []Node

ChildNodes walks only child nodes collecting all nodes that meet the condition

func (*CallExpr) Children

func (s *CallExpr) Children() []Node

Children returns all child nodes

func (*CallExpr) ChildrenByNodeType

func (s *CallExpr) ChildrenByNodeType(nodeType NodeType) []Node

ChildrenByNodeType returns the first child of a certain type.

func (*CallExpr) Contains

func (s *CallExpr) Contains(node Node) bool

Contains checks if a node contains another node

func (*CallExpr) FindByName

func (s *CallExpr) FindByName(name string) []Node

FindByName looks for a name in the entire sub tree

func (*CallExpr) FindByNodeType

func (s *CallExpr) FindByNodeType(nodeType NodeType) []Node

FindByNodeType returns all sub nodes of a certain type

func (*CallExpr) FindByToken

func (s *CallExpr) FindByToken(t token.Token) []Node

FindByToken finds a node with a token.Token attached and of given token type

func (*CallExpr) FindByValueType

func (s *CallExpr) FindByValueType(valType string) []Node

FindByValueType find all nodes with given value type

func (*CallExpr) FindDeclarations

func (s *CallExpr) FindDeclarations() []*Ident

FindDeclarations finds all declarations

func (*CallExpr) FindDeclarationsByType

func (s *CallExpr) FindDeclarationsByType(nodeType NodeType) []*Ident

FindDeclarationsByType finds all declarations by (parent) type

func (*CallExpr) FindFirstByName

func (s *CallExpr) FindFirstByName(name string) Node

FindFirstByName looks for a name in the entire sub tree. First node is returned if there are multiple.

func (*CallExpr) FindFirstByNodeType

func (s *CallExpr) FindFirstByNodeType(nodeType NodeType) Node

FindFirstByNodeType returns the first sub node of a certain type

func (*CallExpr) FindFirstIdentByName

func (s *CallExpr) FindFirstIdentByName(name string) *Ident

FindFirstIdentByName looks for the first Ident node in subtree with given name

func (*CallExpr) FindFirstUsage

func (s *CallExpr) FindFirstUsage(declaration *Ident) *Ident

FindFirstUsage selects the first usage

func (*CallExpr) FindIdentByName

func (s *CallExpr) FindIdentByName(name string) []*Ident

FindIdentByName looks for Ident nodes in the entire sub tree with given name

func (*CallExpr) FindMaps

func (s *CallExpr) FindMaps() []Node

FindMaps find all nodes with given value type

func (*CallExpr) FindNameInCallTree

func (s *CallExpr) FindNameInCallTree(name string) []Node

FindNameInCallTree returns all nodes in call tree with given name

func (*CallExpr) FindNodeTypeInCallTree

func (s *CallExpr) FindNodeTypeInCallTree(nodeType NodeType) []Node

FindNodeTypeInCallTree returns all nodes in call tree of a certain type

func (*CallExpr) FindUsages

func (s *CallExpr) FindUsages(declaration *Ident) []*Ident

FindUsages finds usages of given declaration

func (*CallExpr) FindVarDeclarations

func (s *CallExpr) FindVarDeclarations() []*Ident

FindVarDeclarations finds all assignStmt (:=), valueSpec (var, const) declarations

func (*CallExpr) GetIdent

func (s *CallExpr) GetIdent() *Ident

GetIdent returns the name of the node

func (*CallExpr) GetScope

func (s *CallExpr) GetScope() (Node, *types.Scope)

GetScope returns the scope of the node

func (*CallExpr) GetSource

func (s *CallExpr) GetSource() []byte

GetSource returns the source code of the current node

func (*CallExpr) GetSourceString

func (s *CallExpr) GetSourceString() string

GetSourceString is a convenience function to GetSource as string

func (*CallExpr) Info

func (s *CallExpr) Info() *types.Info

Info returns the types.info node.

func (*CallExpr) IsContainedByType

func (s *CallExpr) IsContainedByType(nodeType NodeType) bool

IsContainedByType checks if node is contained by a node of given node type

func (*CallExpr) IsNodeType

func (s *CallExpr) IsNodeType(nodeType NodeType) bool

IsNodeType checks if node is of given node type

func (*CallExpr) IsValueType

func (s *CallExpr) IsValueType(valType string) bool

IsValueType checks if value type is of given type

func (*CallExpr) Level

func (s *CallExpr) Level() int

Level returns the level counted from instantiated node = 0

func (*CallExpr) Match

func (s *CallExpr) Match(regex regexp.Regexp) bool

Match matches the source code of current node and content with given regex

func (*CallExpr) NextParentByType

func (s *CallExpr) NextParentByType(nodeType NodeType) Node

NextParentByType returns the next parent of given type

func (*CallExpr) NodeName

func (s *CallExpr) NodeName() string

NodeName returns the name of the node

func (*CallExpr) NodeType

func (s *CallExpr) NodeType() NodeType

NodeType returns the NodeType of the node

func (*CallExpr) Object

func (s *CallExpr) Object() types.Object

Object returns the object of an identifier, nil otherwise

func (*CallExpr) Parent

func (s *CallExpr) Parent() Node

Parent return the parent node

func (*CallExpr) Parents

func (s *CallExpr) Parents() []Node

Parents returns the parent path of nodes

func (*CallExpr) Pkg

func (s *CallExpr) Pkg() *Package

Pkg returns the package this node belongs to.

func (*CallExpr) Siblings

func (s *CallExpr) Siblings() []Node

Siblings returns all sibling nodes

func (*CallExpr) TreeNode

func (s *CallExpr) TreeNode(cond func(n Node) bool) Node

TreeNode walks the child tree returning the first node that meets the condition

func (*CallExpr) TreeNodes

func (s *CallExpr) TreeNodes(cond func(n Node) bool) []Node

TreeNodes walks the child tree collecting all nodes that meet the condition

func (*CallExpr) ValueType

func (s *CallExpr) ValueType() types.Type

ValueType returns value type information of an expression, nil otherwise

func (*CallExpr) Visit

func (s *CallExpr) Visit(node ast.Node) ast.Visitor

Visit implements the ast.Visitor interface and is used to walk the underlying ast.Node tree

func (*CallExpr) Walk

func (s *CallExpr) Walk(f func(node Node) bool)

Walk traverses the tree and its children. return false to skip children of the current element

type CaseClause

type CaseClause struct {
	*ast.CaseClause
	// contains filtered or unexported fields
}

CaseClause wraps ast.CaseClause

func (*CaseClause) AstNode

func (s *CaseClause) AstNode() ast.Node

AstNode returns the original ast.Node

func (CaseClause) CallTreeNode

func (s CaseClause) CallTreeNode(cond func(n Node) bool) Node

CallTreeNode walks the call tree returning the first node that meets the condition

func (CaseClause) CallTreeNodes

func (s CaseClause) CallTreeNodes(cond func(n Node) bool) []Node

CallTreeNodes walks the call tree collecting all nodes that meet the condition

func (*CaseClause) ChildByName

func (s *CaseClause) ChildByName(name string) Node

ChildByName retrieves a node among the direkt children by name (only nodes that have a name)

func (*CaseClause) ChildByNodeType

func (s *CaseClause) ChildByNodeType(nodeType NodeType) Node

ChildByNodeType returns the first child of a certain type.

func (*CaseClause) ChildNode

func (s *CaseClause) ChildNode(cond func(n Node) bool) Node

ChildNode walks only child nodes returning the first node that meets the condition

func (*CaseClause) ChildNodes

func (s *CaseClause) ChildNodes(cond func(n Node) bool) []Node

ChildNodes walks only child nodes collecting all nodes that meet the condition

func (*CaseClause) Children

func (s *CaseClause) Children() []Node

Children returns all child nodes

func (*CaseClause) ChildrenByNodeType

func (s *CaseClause) ChildrenByNodeType(nodeType NodeType) []Node

ChildrenByNodeType returns the first child of a certain type.

func (*CaseClause) Contains

func (s *CaseClause) Contains(node Node) bool

Contains checks if a node contains another node

func (*CaseClause) FindByName

func (s *CaseClause) FindByName(name string) []Node

FindByName looks for a name in the entire sub tree

func (*CaseClause) FindByNodeType

func (s *CaseClause) FindByNodeType(nodeType NodeType) []Node

FindByNodeType returns all sub nodes of a certain type

func (*CaseClause) FindByToken

func (s *CaseClause) FindByToken(t token.Token) []Node

FindByToken finds a node with a token.Token attached and of given token type

func (*CaseClause) FindByValueType

func (s *CaseClause) FindByValueType(valType string) []Node

FindByValueType find all nodes with given value type

func (*CaseClause) FindDeclarations

func (s *CaseClause) FindDeclarations() []*Ident

FindDeclarations finds all declarations

func (*CaseClause) FindDeclarationsByType

func (s *CaseClause) FindDeclarationsByType(nodeType NodeType) []*Ident

FindDeclarationsByType finds all declarations by (parent) type

func (*CaseClause) FindFirstByName

func (s *CaseClause) FindFirstByName(name string) Node

FindFirstByName looks for a name in the entire sub tree. First node is returned if there are multiple.

func (*CaseClause) FindFirstByNodeType

func (s *CaseClause) FindFirstByNodeType(nodeType NodeType) Node

FindFirstByNodeType returns the first sub node of a certain type

func (*CaseClause) FindFirstIdentByName

func (s *CaseClause) FindFirstIdentByName(name string) *Ident

FindFirstIdentByName looks for the first Ident node in subtree with given name

func (*CaseClause) FindFirstUsage

func (s *CaseClause) FindFirstUsage(declaration *Ident) *Ident

FindFirstUsage selects the first usage

func (*CaseClause) FindIdentByName

func (s *CaseClause) FindIdentByName(name string) []*Ident

FindIdentByName looks for Ident nodes in the entire sub tree with given name

func (*CaseClause) FindMaps

func (s *CaseClause) FindMaps() []Node

FindMaps find all nodes with given value type

func (*CaseClause) FindNameInCallTree

func (s *CaseClause) FindNameInCallTree(name string) []Node

FindNameInCallTree returns all nodes in call tree with given name

func (*CaseClause) FindNodeTypeInCallTree

func (s *CaseClause) FindNodeTypeInCallTree(nodeType NodeType) []Node

FindNodeTypeInCallTree returns all nodes in call tree of a certain type

func (*CaseClause) FindUsages

func (s *CaseClause) FindUsages(declaration *Ident) []*Ident

FindUsages finds usages of given declaration

func (*CaseClause) FindVarDeclarations

func (s *CaseClause) FindVarDeclarations() []*Ident

FindVarDeclarations finds all assignStmt (:=), valueSpec (var, const) declarations

func (*CaseClause) GetScope

func (s *CaseClause) GetScope() (Node, *types.Scope)

GetScope returns the scope of the node

func (*CaseClause) GetSource

func (s *CaseClause) GetSource() []byte

GetSource returns the source code of the current node

func (*CaseClause) GetSourceString

func (s *CaseClause) GetSourceString() string

GetSourceString is a convenience function to GetSource as string

func (*CaseClause) Info

func (s *CaseClause) Info() *types.Info

Info returns the types.info node.

func (*CaseClause) IsContainedByType

func (s *CaseClause) IsContainedByType(nodeType NodeType) bool

IsContainedByType checks if node is contained by a node of given node type

func (*CaseClause) IsNodeType

func (s *CaseClause) IsNodeType(nodeType NodeType) bool

IsNodeType checks if node is of given node type

func (*CaseClause) IsValueType

func (s *CaseClause) IsValueType(valType string) bool

IsValueType checks if value type is of given type

func (*CaseClause) Level

func (s *CaseClause) Level() int

Level returns the level counted from instantiated node = 0

func (*CaseClause) Match

func (s *CaseClause) Match(regex regexp.Regexp) bool

Match matches the source code of current node and content with given regex

func (*CaseClause) NextParentByType

func (s *CaseClause) NextParentByType(nodeType NodeType) Node

NextParentByType returns the next parent of given type

func (*CaseClause) NodeType

func (s *CaseClause) NodeType() NodeType

NodeType returns the NodeType of the node

func (*CaseClause) Object

func (s *CaseClause) Object() types.Object

Object returns the object of an identifier, nil otherwise

func (*CaseClause) Parent

func (s *CaseClause) Parent() Node

Parent return the parent node

func (*CaseClause) Parents

func (s *CaseClause) Parents() []Node

Parents returns the parent path of nodes

func (*CaseClause) Pkg

func (s *CaseClause) Pkg() *Package

Pkg returns the package this node belongs to.

func (*CaseClause) Siblings

func (s *CaseClause) Siblings() []Node

Siblings returns all sibling nodes

func (*CaseClause) TreeNode

func (s *CaseClause) TreeNode(cond func(n Node) bool) Node

TreeNode walks the child tree returning the first node that meets the condition

func (*CaseClause) TreeNodes

func (s *CaseClause) TreeNodes(cond func(n Node) bool) []Node

TreeNodes walks the child tree collecting all nodes that meet the condition

func (*CaseClause) ValueType

func (s *CaseClause) ValueType() types.Type

ValueType returns value type information of an expression, nil otherwise

func (*CaseClause) Visit

func (s *CaseClause) Visit(node ast.Node) ast.Visitor

Visit implements the ast.Visitor interface and is used to walk the underlying ast.Node tree

func (*CaseClause) Walk

func (s *CaseClause) Walk(f func(node Node) bool)

Walk traverses the tree and its children. return false to skip children of the current element

type ChanType

type ChanType struct {
	*ast.ChanType
	// contains filtered or unexported fields
}

ChanType wraps ast.ChanType

func (*ChanType) AstNode

func (s *ChanType) AstNode() ast.Node

AstNode returns the original ast.Node

func (ChanType) CallTreeNode

func (s ChanType) CallTreeNode(cond func(n Node) bool) Node

CallTreeNode walks the call tree returning the first node that meets the condition

func (ChanType) CallTreeNodes

func (s ChanType) CallTreeNodes(cond func(n Node) bool) []Node

CallTreeNodes walks the call tree collecting all nodes that meet the condition

func (*ChanType) ChildByName

func (s *ChanType) ChildByName(name string) Node

ChildByName retrieves a node among the direkt children by name (only nodes that have a name)

func (*ChanType) ChildByNodeType

func (s *ChanType) ChildByNodeType(nodeType NodeType) Node

ChildByNodeType returns the first child of a certain type.

func (*ChanType) ChildNode

func (s *ChanType) ChildNode(cond func(n Node) bool) Node

ChildNode walks only child nodes returning the first node that meets the condition

func (*ChanType) ChildNodes

func (s *ChanType) ChildNodes(cond func(n Node) bool) []Node

ChildNodes walks only child nodes collecting all nodes that meet the condition

func (*ChanType) Children

func (s *ChanType) Children() []Node

Children returns all child nodes

func (*ChanType) ChildrenByNodeType

func (s *ChanType) ChildrenByNodeType(nodeType NodeType) []Node

ChildrenByNodeType returns the first child of a certain type.

func (*ChanType) Contains

func (s *ChanType) Contains(node Node) bool

Contains checks if a node contains another node

func (*ChanType) FindByName

func (s *ChanType) FindByName(name string) []Node

FindByName looks for a name in the entire sub tree

func (*ChanType) FindByNodeType

func (s *ChanType) FindByNodeType(nodeType NodeType) []Node

FindByNodeType returns all sub nodes of a certain type

func (*ChanType) FindByToken

func (s *ChanType) FindByToken(t token.Token) []Node

FindByToken finds a node with a token.Token attached and of given token type

func (*ChanType) FindByValueType

func (s *ChanType) FindByValueType(valType string) []Node

FindByValueType find all nodes with given value type

func (*ChanType) FindDeclarations

func (s *ChanType) FindDeclarations() []*Ident

FindDeclarations finds all declarations

func (*ChanType) FindDeclarationsByType

func (s *ChanType) FindDeclarationsByType(nodeType NodeType) []*Ident

FindDeclarationsByType finds all declarations by (parent) type

func (*ChanType) FindFirstByName

func (s *ChanType) FindFirstByName(name string) Node

FindFirstByName looks for a name in the entire sub tree. First node is returned if there are multiple.

func (*ChanType) FindFirstByNodeType

func (s *ChanType) FindFirstByNodeType(nodeType NodeType) Node

FindFirstByNodeType returns the first sub node of a certain type

func (*ChanType) FindFirstIdentByName

func (s *ChanType) FindFirstIdentByName(name string) *Ident

FindFirstIdentByName looks for the first Ident node in subtree with given name

func (*ChanType) FindFirstUsage

func (s *ChanType) FindFirstUsage(declaration *Ident) *Ident

FindFirstUsage selects the first usage

func (*ChanType) FindIdentByName

func (s *ChanType) FindIdentByName(name string) []*Ident

FindIdentByName looks for Ident nodes in the entire sub tree with given name

func (*ChanType) FindMaps

func (s *ChanType) FindMaps() []Node

FindMaps find all nodes with given value type

func (*ChanType) FindNameInCallTree

func (s *ChanType) FindNameInCallTree(name string) []Node

FindNameInCallTree returns all nodes in call tree with given name

func (*ChanType) FindNodeTypeInCallTree

func (s *ChanType) FindNodeTypeInCallTree(nodeType NodeType) []Node

FindNodeTypeInCallTree returns all nodes in call tree of a certain type

func (*ChanType) FindUsages

func (s *ChanType) FindUsages(declaration *Ident) []*Ident

FindUsages finds usages of given declaration

func (*ChanType) FindVarDeclarations

func (s *ChanType) FindVarDeclarations() []*Ident

FindVarDeclarations finds all assignStmt (:=), valueSpec (var, const) declarations

func (*ChanType) GetScope

func (s *ChanType) GetScope() (Node, *types.Scope)

GetScope returns the scope of the node

func (*ChanType) GetSource

func (s *ChanType) GetSource() []byte

GetSource returns the source code of the current node

func (*ChanType) GetSourceString

func (s *ChanType) GetSourceString() string

GetSourceString is a convenience function to GetSource as string

func (*ChanType) Info

func (s *ChanType) Info() *types.Info

Info returns the types.info node.

func (*ChanType) IsContainedByType

func (s *ChanType) IsContainedByType(nodeType NodeType) bool

IsContainedByType checks if node is contained by a node of given node type

func (*ChanType) IsNodeType

func (s *ChanType) IsNodeType(nodeType NodeType) bool

IsNodeType checks if node is of given node type

func (*ChanType) IsValueType

func (s *ChanType) IsValueType(valType string) bool

IsValueType checks if value type is of given type

func (*ChanType) Level

func (s *ChanType) Level() int

Level returns the level counted from instantiated node = 0

func (*ChanType) Match

func (s *ChanType) Match(regex regexp.Regexp) bool

Match matches the source code of current node and content with given regex

func (*ChanType) NextParentByType

func (s *ChanType) NextParentByType(nodeType NodeType) Node

NextParentByType returns the next parent of given type

func (*ChanType) NodeType

func (s *ChanType) NodeType() NodeType

NodeType returns the NodeType of the node

func (*ChanType) Object

func (s *ChanType) Object() types.Object

Object returns the object of an identifier, nil otherwise

func (*ChanType) Parent

func (s *ChanType) Parent() Node

Parent return the parent node

func (*ChanType) Parents

func (s *ChanType) Parents() []Node

Parents returns the parent path of nodes

func (*ChanType) Pkg

func (s *ChanType) Pkg() *Package

Pkg returns the package this node belongs to.

func (*ChanType) Siblings

func (s *ChanType) Siblings() []Node

Siblings returns all sibling nodes

func (*ChanType) TreeNode

func (s *ChanType) TreeNode(cond func(n Node) bool) Node

TreeNode walks the child tree returning the first node that meets the condition

func (*ChanType) TreeNodes

func (s *ChanType) TreeNodes(cond func(n Node) bool) []Node

TreeNodes walks the child tree collecting all nodes that meet the condition

func (*ChanType) ValueType

func (s *ChanType) ValueType() types.Type

ValueType returns value type information of an expression, nil otherwise

func (*ChanType) Visit

func (s *ChanType) Visit(node ast.Node) ast.Visitor

Visit implements the ast.Visitor interface and is used to walk the underlying ast.Node tree

func (*ChanType) Walk

func (s *ChanType) Walk(f func(node Node) bool)

Walk traverses the tree and its children. return false to skip children of the current element

type CommClause

type CommClause struct {
	*ast.CommClause
	// contains filtered or unexported fields
}

CommClause wraps ast.CommClause

func (*CommClause) AstNode

func (s *CommClause) AstNode() ast.Node

AstNode returns the original ast.Node

func (CommClause) CallTreeNode

func (s CommClause) CallTreeNode(cond func(n Node) bool) Node

CallTreeNode walks the call tree returning the first node that meets the condition

func (CommClause) CallTreeNodes

func (s CommClause) CallTreeNodes(cond func(n Node) bool) []Node

CallTreeNodes walks the call tree collecting all nodes that meet the condition

func (*CommClause) ChildByName

func (s *CommClause) ChildByName(name string) Node

ChildByName retrieves a node among the direkt children by name (only nodes that have a name)

func (*CommClause) ChildByNodeType

func (s *CommClause) ChildByNodeType(nodeType NodeType) Node

ChildByNodeType returns the first child of a certain type.

func (*CommClause) ChildNode

func (s *CommClause) ChildNode(cond func(n Node) bool) Node

ChildNode walks only child nodes returning the first node that meets the condition

func (*CommClause) ChildNodes

func (s *CommClause) ChildNodes(cond func(n Node) bool) []Node

ChildNodes walks only child nodes collecting all nodes that meet the condition

func (*CommClause) Children

func (s *CommClause) Children() []Node

Children returns all child nodes

func (*CommClause) ChildrenByNodeType

func (s *CommClause) ChildrenByNodeType(nodeType NodeType) []Node

ChildrenByNodeType returns the first child of a certain type.

func (*CommClause) Contains

func (s *CommClause) Contains(node Node) bool

Contains checks if a node contains another node

func (*CommClause) FindByName

func (s *CommClause) FindByName(name string) []Node

FindByName looks for a name in the entire sub tree

func (*CommClause) FindByNodeType

func (s *CommClause) FindByNodeType(nodeType NodeType) []Node

FindByNodeType returns all sub nodes of a certain type

func (*CommClause) FindByToken

func (s *CommClause) FindByToken(t token.Token) []Node

FindByToken finds a node with a token.Token attached and of given token type

func (*CommClause) FindByValueType

func (s *CommClause) FindByValueType(valType string) []Node

FindByValueType find all nodes with given value type

func (*CommClause) FindDeclarations

func (s *CommClause) FindDeclarations() []*Ident

FindDeclarations finds all declarations

func (*CommClause) FindDeclarationsByType

func (s *CommClause) FindDeclarationsByType(nodeType NodeType) []*Ident

FindDeclarationsByType finds all declarations by (parent) type

func (*CommClause) FindFirstByName

func (s *CommClause) FindFirstByName(name string) Node

FindFirstByName looks for a name in the entire sub tree. First node is returned if there are multiple.

func (*CommClause) FindFirstByNodeType

func (s *CommClause) FindFirstByNodeType(nodeType NodeType) Node

FindFirstByNodeType returns the first sub node of a certain type

func (*CommClause) FindFirstIdentByName

func (s *CommClause) FindFirstIdentByName(name string) *Ident

FindFirstIdentByName looks for the first Ident node in subtree with given name

func (*CommClause) FindFirstUsage

func (s *CommClause) FindFirstUsage(declaration *Ident) *Ident

FindFirstUsage selects the first usage

func (*CommClause) FindIdentByName

func (s *CommClause) FindIdentByName(name string) []*Ident

FindIdentByName looks for Ident nodes in the entire sub tree with given name

func (*CommClause) FindMaps

func (s *CommClause) FindMaps() []Node

FindMaps find all nodes with given value type

func (*CommClause) FindNameInCallTree

func (s *CommClause) FindNameInCallTree(name string) []Node

FindNameInCallTree returns all nodes in call tree with given name

func (*CommClause) FindNodeTypeInCallTree

func (s *CommClause) FindNodeTypeInCallTree(nodeType NodeType) []Node

FindNodeTypeInCallTree returns all nodes in call tree of a certain type

func (*CommClause) FindUsages

func (s *CommClause) FindUsages(declaration *Ident) []*Ident

FindUsages finds usages of given declaration

func (*CommClause) FindVarDeclarations

func (s *CommClause) FindVarDeclarations() []*Ident

FindVarDeclarations finds all assignStmt (:=), valueSpec (var, const) declarations

func (*CommClause) GetScope

func (s *CommClause) GetScope() (Node, *types.Scope)

GetScope returns the scope of the node

func (*CommClause) GetSource

func (s *CommClause) GetSource() []byte

GetSource returns the source code of the current node

func (*CommClause) GetSourceString

func (s *CommClause) GetSourceString() string

GetSourceString is a convenience function to GetSource as string

func (*CommClause) Info

func (s *CommClause) Info() *types.Info

Info returns the types.info node.

func (*CommClause) IsContainedByType

func (s *CommClause) IsContainedByType(nodeType NodeType) bool

IsContainedByType checks if node is contained by a node of given node type

func (*CommClause) IsNodeType

func (s *CommClause) IsNodeType(nodeType NodeType) bool

IsNodeType checks if node is of given node type

func (*CommClause) IsValueType

func (s *CommClause) IsValueType(valType string) bool

IsValueType checks if value type is of given type

func (*CommClause) Level

func (s *CommClause) Level() int

Level returns the level counted from instantiated node = 0

func (*CommClause) Match

func (s *CommClause) Match(regex regexp.Regexp) bool

Match matches the source code of current node and content with given regex

func (*CommClause) NextParentByType

func (s *CommClause) NextParentByType(nodeType NodeType) Node

NextParentByType returns the next parent of given type

func (*CommClause) NodeType

func (s *CommClause) NodeType() NodeType

NodeType returns the NodeType of the node

func (*CommClause) Object

func (s *CommClause) Object() types.Object

Object returns the object of an identifier, nil otherwise

func (*CommClause) Parent

func (s *CommClause) Parent() Node

Parent return the parent node

func (*CommClause) Parents

func (s *CommClause) Parents() []Node

Parents returns the parent path of nodes

func (*CommClause) Pkg

func (s *CommClause) Pkg() *Package

Pkg returns the package this node belongs to.

func (*CommClause) Siblings

func (s *CommClause) Siblings() []Node

Siblings returns all sibling nodes

func (*CommClause) TreeNode

func (s *CommClause) TreeNode(cond func(n Node) bool) Node

TreeNode walks the child tree returning the first node that meets the condition

func (*CommClause) TreeNodes

func (s *CommClause) TreeNodes(cond func(n Node) bool) []Node

TreeNodes walks the child tree collecting all nodes that meet the condition

func (*CommClause) ValueType

func (s *CommClause) ValueType() types.Type

ValueType returns value type information of an expression, nil otherwise

func (*CommClause) Visit

func (s *CommClause) Visit(node ast.Node) ast.Visitor

Visit implements the ast.Visitor interface and is used to walk the underlying ast.Node tree

func (*CommClause) Walk

func (s *CommClause) Walk(f func(node Node) bool)

Walk traverses the tree and its children. return false to skip children of the current element

type Comment

type Comment struct {
	*ast.Comment
	// contains filtered or unexported fields
}

Comment wraps ast.Comment

func (*Comment) AstNode

func (s *Comment) AstNode() ast.Node

AstNode returns the original ast.Node

func (Comment) CallTreeNode

func (s Comment) CallTreeNode(cond func(n Node) bool) Node

CallTreeNode walks the call tree returning the first node that meets the condition

func (Comment) CallTreeNodes

func (s Comment) CallTreeNodes(cond func(n Node) bool) []Node

CallTreeNodes walks the call tree collecting all nodes that meet the condition

func (*Comment) ChildByName

func (s *Comment) ChildByName(name string) Node

ChildByName retrieves a node among the direkt children by name (only nodes that have a name)

func (*Comment) ChildByNodeType

func (s *Comment) ChildByNodeType(nodeType NodeType) Node

ChildByNodeType returns the first child of a certain type.

func (*Comment) ChildNode

func (s *Comment) ChildNode(cond func(n Node) bool) Node

ChildNode walks only child nodes returning the first node that meets the condition

func (*Comment) ChildNodes

func (s *Comment) ChildNodes(cond func(n Node) bool) []Node

ChildNodes walks only child nodes collecting all nodes that meet the condition

func (*Comment) Children

func (s *Comment) Children() []Node

Children returns all child nodes

func (*Comment) ChildrenByNodeType

func (s *Comment) ChildrenByNodeType(nodeType NodeType) []Node

ChildrenByNodeType returns the first child of a certain type.

func (*Comment) Contains

func (s *Comment) Contains(node Node) bool

Contains checks if a node contains another node

func (*Comment) FindByName

func (s *Comment) FindByName(name string) []Node

FindByName looks for a name in the entire sub tree

func (*Comment) FindByNodeType

func (s *Comment) FindByNodeType(nodeType NodeType) []Node

FindByNodeType returns all sub nodes of a certain type

func (*Comment) FindByToken

func (s *Comment) FindByToken(t token.Token) []Node

FindByToken finds a node with a token.Token attached and of given token type

func (*Comment) FindByValueType

func (s *Comment) FindByValueType(valType string) []Node

FindByValueType find all nodes with given value type

func (*Comment) FindDeclarations

func (s *Comment) FindDeclarations() []*Ident

FindDeclarations finds all declarations

func (*Comment) FindDeclarationsByType

func (s *Comment) FindDeclarationsByType(nodeType NodeType) []*Ident

FindDeclarationsByType finds all declarations by (parent) type

func (*Comment) FindFirstByName

func (s *Comment) FindFirstByName(name string) Node

FindFirstByName looks for a name in the entire sub tree. First node is returned if there are multiple.

func (*Comment) FindFirstByNodeType

func (s *Comment) FindFirstByNodeType(nodeType NodeType) Node

FindFirstByNodeType returns the first sub node of a certain type

func (*Comment) FindFirstIdentByName

func (s *Comment) FindFirstIdentByName(name string) *Ident

FindFirstIdentByName looks for the first Ident node in subtree with given name

func (*Comment) FindFirstUsage

func (s *Comment) FindFirstUsage(declaration *Ident) *Ident

FindFirstUsage selects the first usage

func (*Comment) FindIdentByName

func (s *Comment) FindIdentByName(name string) []*Ident

FindIdentByName looks for Ident nodes in the entire sub tree with given name

func (*Comment) FindMaps

func (s *Comment) FindMaps() []Node

FindMaps find all nodes with given value type

func (*Comment) FindNameInCallTree

func (s *Comment) FindNameInCallTree(name string) []Node

FindNameInCallTree returns all nodes in call tree with given name

func (*Comment) FindNodeTypeInCallTree

func (s *Comment) FindNodeTypeInCallTree(nodeType NodeType) []Node

FindNodeTypeInCallTree returns all nodes in call tree of a certain type

func (*Comment) FindUsages

func (s *Comment) FindUsages(declaration *Ident) []*Ident

FindUsages finds usages of given declaration

func (*Comment) FindVarDeclarations

func (s *Comment) FindVarDeclarations() []*Ident

FindVarDeclarations finds all assignStmt (:=), valueSpec (var, const) declarations

func (*Comment) GetScope

func (s *Comment) GetScope() (Node, *types.Scope)

GetScope returns the scope of the node

func (*Comment) GetSource

func (s *Comment) GetSource() []byte

GetSource returns the source code of the current node

func (*Comment) GetSourceString

func (s *Comment) GetSourceString() string

GetSourceString is a convenience function to GetSource as string

func (*Comment) Info

func (s *Comment) Info() *types.Info

Info returns the types.info node.

func (*Comment) IsContainedByType

func (s *Comment) IsContainedByType(nodeType NodeType) bool

IsContainedByType checks if node is contained by a node of given node type

func (*Comment) IsNodeType

func (s *Comment) IsNodeType(nodeType NodeType) bool

IsNodeType checks if node is of given node type

func (*Comment) IsValueType

func (s *Comment) IsValueType(valType string) bool

IsValueType checks if value type is of given type

func (*Comment) Level

func (s *Comment) Level() int

Level returns the level counted from instantiated node = 0

func (*Comment) Match

func (s *Comment) Match(regex regexp.Regexp) bool

Match matches the source code of current node and content with given regex

func (*Comment) NextParentByType

func (s *Comment) NextParentByType(nodeType NodeType) Node

NextParentByType returns the next parent of given type

func (*Comment) NodeType

func (s *Comment) NodeType() NodeType

NodeType returns the NodeType of the node

func (*Comment) Object

func (s *Comment) Object() types.Object

Object returns the object of an identifier, nil otherwise

func (*Comment) Parent

func (s *Comment) Parent() Node

Parent return the parent node

func (*Comment) Parents

func (s *Comment) Parents() []Node

Parents returns the parent path of nodes

func (*Comment) Pkg

func (s *Comment) Pkg() *Package

Pkg returns the package this node belongs to.

func (*Comment) Siblings

func (s *Comment) Siblings() []Node

Siblings returns all sibling nodes

func (*Comment) TreeNode

func (s *Comment) TreeNode(cond func(n Node) bool) Node

TreeNode walks the child tree returning the first node that meets the condition

func (*Comment) TreeNodes

func (s *Comment) TreeNodes(cond func(n Node) bool) []Node

TreeNodes walks the child tree collecting all nodes that meet the condition

func (*Comment) ValueType

func (s *Comment) ValueType() types.Type

ValueType returns value type information of an expression, nil otherwise

func (*Comment) Visit

func (s *Comment) Visit(node ast.Node) ast.Visitor

Visit implements the ast.Visitor interface and is used to walk the underlying ast.Node tree

func (*Comment) Walk

func (s *Comment) Walk(f func(node Node) bool)

Walk traverses the tree and its children. return false to skip children of the current element

type CommentGroup

type CommentGroup struct {
	*ast.CommentGroup
	// contains filtered or unexported fields
}

CommentGroup wraps ast.CommentGroup

func (*CommentGroup) AstNode

func (s *CommentGroup) AstNode() ast.Node

AstNode returns the original ast.Node

func (CommentGroup) CallTreeNode

func (s CommentGroup) CallTreeNode(cond func(n Node) bool) Node

CallTreeNode walks the call tree returning the first node that meets the condition

func (CommentGroup) CallTreeNodes

func (s CommentGroup) CallTreeNodes(cond func(n Node) bool) []Node

CallTreeNodes walks the call tree collecting all nodes that meet the condition

func (*CommentGroup) ChildByName

func (s *CommentGroup) ChildByName(name string) Node

ChildByName retrieves a node among the direkt children by name (only nodes that have a name)

func (*CommentGroup) ChildByNodeType

func (s *CommentGroup) ChildByNodeType(nodeType NodeType) Node

ChildByNodeType returns the first child of a certain type.

func (*CommentGroup) ChildNode

func (s *CommentGroup) ChildNode(cond func(n Node) bool) Node

ChildNode walks only child nodes returning the first node that meets the condition

func (*CommentGroup) ChildNodes

func (s *CommentGroup) ChildNodes(cond func(n Node) bool) []Node

ChildNodes walks only child nodes collecting all nodes that meet the condition

func (*CommentGroup) Children

func (s *CommentGroup) Children() []Node

Children returns all child nodes

func (*CommentGroup) ChildrenByNodeType

func (s *CommentGroup) ChildrenByNodeType(nodeType NodeType) []Node

ChildrenByNodeType returns the first child of a certain type.

func (*CommentGroup) Contains

func (s *CommentGroup) Contains(node Node) bool

Contains checks if a node contains another node

func (*CommentGroup) FindByName

func (s *CommentGroup) FindByName(name string) []Node

FindByName looks for a name in the entire sub tree

func (*CommentGroup) FindByNodeType

func (s *CommentGroup) FindByNodeType(nodeType NodeType) []Node

FindByNodeType returns all sub nodes of a certain type

func (*CommentGroup) FindByToken

func (s *CommentGroup) FindByToken(t token.Token) []Node

FindByToken finds a node with a token.Token attached and of given token type

func (*CommentGroup) FindByValueType

func (s *CommentGroup) FindByValueType(valType string) []Node

FindByValueType find all nodes with given value type

func (*CommentGroup) FindDeclarations

func (s *CommentGroup) FindDeclarations() []*Ident

FindDeclarations finds all declarations

func (*CommentGroup) FindDeclarationsByType

func (s *CommentGroup) FindDeclarationsByType(nodeType NodeType) []*Ident

FindDeclarationsByType finds all declarations by (parent) type

func (*CommentGroup) FindFirstByName

func (s *CommentGroup) FindFirstByName(name string) Node

FindFirstByName looks for a name in the entire sub tree. First node is returned if there are multiple.

func (*CommentGroup) FindFirstByNodeType

func (s *CommentGroup) FindFirstByNodeType(nodeType NodeType) Node

FindFirstByNodeType returns the first sub node of a certain type

func (*CommentGroup) FindFirstIdentByName

func (s *CommentGroup) FindFirstIdentByName(name string) *Ident

FindFirstIdentByName looks for the first Ident node in subtree with given name

func (*CommentGroup) FindFirstUsage

func (s *CommentGroup) FindFirstUsage(declaration *Ident) *Ident

FindFirstUsage selects the first usage

func (*CommentGroup) FindIdentByName

func (s *CommentGroup) FindIdentByName(name string) []*Ident

FindIdentByName looks for Ident nodes in the entire sub tree with given name

func (*CommentGroup) FindMaps

func (s *CommentGroup) FindMaps() []Node

FindMaps find all nodes with given value type

func (*CommentGroup) FindNameInCallTree

func (s *CommentGroup) FindNameInCallTree(name string) []Node

FindNameInCallTree returns all nodes in call tree with given name

func (*CommentGroup) FindNodeTypeInCallTree

func (s *CommentGroup) FindNodeTypeInCallTree(nodeType NodeType) []Node

FindNodeTypeInCallTree returns all nodes in call tree of a certain type

func (*CommentGroup) FindUsages

func (s *CommentGroup) FindUsages(declaration *Ident) []*Ident

FindUsages finds usages of given declaration

func (*CommentGroup) FindVarDeclarations

func (s *CommentGroup) FindVarDeclarations() []*Ident

FindVarDeclarations finds all assignStmt (:=), valueSpec (var, const) declarations

func (*CommentGroup) GetScope

func (s *CommentGroup) GetScope() (Node, *types.Scope)

GetScope returns the scope of the node

func (*CommentGroup) GetSource

func (s *CommentGroup) GetSource() []byte

GetSource returns the source code of the current node

func (*CommentGroup) GetSourceString

func (s *CommentGroup) GetSourceString() string

GetSourceString is a convenience function to GetSource as string

func (*CommentGroup) Info

func (s *CommentGroup) Info() *types.Info

Info returns the types.info node.

func (*CommentGroup) IsContainedByType

func (s *CommentGroup) IsContainedByType(nodeType NodeType) bool

IsContainedByType checks if node is contained by a node of given node type

func (*CommentGroup) IsNodeType

func (s *CommentGroup) IsNodeType(nodeType NodeType) bool

IsNodeType checks if node is of given node type

func (*CommentGroup) IsValueType

func (s *CommentGroup) IsValueType(valType string) bool

IsValueType checks if value type is of given type

func (*CommentGroup) Level

func (s *CommentGroup) Level() int

Level returns the level counted from instantiated node = 0

func (*CommentGroup) Match

func (s *CommentGroup) Match(regex regexp.Regexp) bool

Match matches the source code of current node and content with given regex

func (*CommentGroup) NextParentByType

func (s *CommentGroup) NextParentByType(nodeType NodeType) Node

NextParentByType returns the next parent of given type

func (*CommentGroup) NodeType

func (s *CommentGroup) NodeType() NodeType

NodeType returns the NodeType of the node

func (*CommentGroup) Object

func (s *CommentGroup) Object() types.Object

Object returns the object of an identifier, nil otherwise

func (*CommentGroup) Parent

func (s *CommentGroup) Parent() Node

Parent return the parent node

func (*CommentGroup) Parents

func (s *CommentGroup) Parents() []Node

Parents returns the parent path of nodes

func (*CommentGroup) Pkg

func (s *CommentGroup) Pkg() *Package

Pkg returns the package this node belongs to.

func (*CommentGroup) Siblings

func (s *CommentGroup) Siblings() []Node

Siblings returns all sibling nodes

func (*CommentGroup) TreeNode

func (s *CommentGroup) TreeNode(cond func(n Node) bool) Node

TreeNode walks the child tree returning the first node that meets the condition

func (*CommentGroup) TreeNodes

func (s *CommentGroup) TreeNodes(cond func(n Node) bool) []Node

TreeNodes walks the child tree collecting all nodes that meet the condition

func (*CommentGroup) ValueType

func (s *CommentGroup) ValueType() types.Type

ValueType returns value type information of an expression, nil otherwise

func (*CommentGroup) Visit

func (s *CommentGroup) Visit(node ast.Node) ast.Visitor

Visit implements the ast.Visitor interface and is used to walk the underlying ast.Node tree

func (*CommentGroup) Walk

func (s *CommentGroup) Walk(f func(node Node) bool)

Walk traverses the tree and its children. return false to skip children of the current element

type CompositeLit

type CompositeLit struct {
	*ast.CompositeLit
	// contains filtered or unexported fields
}

CompositeLit wraps ast.CompositeLit

func (*CompositeLit) AstNode

func (s *CompositeLit) AstNode() ast.Node

AstNode returns the original ast.Node

func (CompositeLit) CallTreeNode

func (s CompositeLit) CallTreeNode(cond func(n Node) bool) Node

CallTreeNode walks the call tree returning the first node that meets the condition

func (CompositeLit) CallTreeNodes

func (s CompositeLit) CallTreeNodes(cond func(n Node) bool) []Node

CallTreeNodes walks the call tree collecting all nodes that meet the condition

func (*CompositeLit) ChildByName

func (s *CompositeLit) ChildByName(name string) Node

ChildByName retrieves a node among the direkt children by name (only nodes that have a name)

func (*CompositeLit) ChildByNodeType

func (s *CompositeLit) ChildByNodeType(nodeType NodeType) Node

ChildByNodeType returns the first child of a certain type.

func (*CompositeLit) ChildNode

func (s *CompositeLit) ChildNode(cond func(n Node) bool) Node

ChildNode walks only child nodes returning the first node that meets the condition

func (*CompositeLit) ChildNodes

func (s *CompositeLit) ChildNodes(cond func(n Node) bool) []Node

ChildNodes walks only child nodes collecting all nodes that meet the condition

func (*CompositeLit) Children

func (s *CompositeLit) Children() []Node

Children returns all child nodes

func (*CompositeLit) ChildrenByNodeType

func (s *CompositeLit) ChildrenByNodeType(nodeType NodeType) []Node

ChildrenByNodeType returns the first child of a certain type.

func (*CompositeLit) Contains

func (s *CompositeLit) Contains(node Node) bool

Contains checks if a node contains another node

func (*CompositeLit) FindByName

func (s *CompositeLit) FindByName(name string) []Node

FindByName looks for a name in the entire sub tree

func (*CompositeLit) FindByNodeType

func (s *CompositeLit) FindByNodeType(nodeType NodeType) []Node

FindByNodeType returns all sub nodes of a certain type

func (*CompositeLit) FindByToken

func (s *CompositeLit) FindByToken(t token.Token) []Node

FindByToken finds a node with a token.Token attached and of given token type

func (*CompositeLit) FindByValueType

func (s *CompositeLit) FindByValueType(valType string) []Node

FindByValueType find all nodes with given value type

func (*CompositeLit) FindDeclarations

func (s *CompositeLit) FindDeclarations() []*Ident

FindDeclarations finds all declarations

func (*CompositeLit) FindDeclarationsByType

func (s *CompositeLit) FindDeclarationsByType(nodeType NodeType) []*Ident

FindDeclarationsByType finds all declarations by (parent) type

func (*CompositeLit) FindFirstByName

func (s *CompositeLit) FindFirstByName(name string) Node

FindFirstByName looks for a name in the entire sub tree. First node is returned if there are multiple.

func (*CompositeLit) FindFirstByNodeType

func (s *CompositeLit) FindFirstByNodeType(nodeType NodeType) Node

FindFirstByNodeType returns the first sub node of a certain type

func (*CompositeLit) FindFirstIdentByName

func (s *CompositeLit) FindFirstIdentByName(name string) *Ident

FindFirstIdentByName looks for the first Ident node in subtree with given name

func (*CompositeLit) FindFirstUsage

func (s *CompositeLit) FindFirstUsage(declaration *Ident) *Ident

FindFirstUsage selects the first usage

func (*CompositeLit) FindIdentByName

func (s *CompositeLit) FindIdentByName(name string) []*Ident

FindIdentByName looks for Ident nodes in the entire sub tree with given name

func (*CompositeLit) FindMaps

func (s *CompositeLit) FindMaps() []Node

FindMaps find all nodes with given value type

func (*CompositeLit) FindNameInCallTree

func (s *CompositeLit) FindNameInCallTree(name string) []Node

FindNameInCallTree returns all nodes in call tree with given name

func (*CompositeLit) FindNodeTypeInCallTree

func (s *CompositeLit) FindNodeTypeInCallTree(nodeType NodeType) []Node

FindNodeTypeInCallTree returns all nodes in call tree of a certain type

func (*CompositeLit) FindUsages

func (s *CompositeLit) FindUsages(declaration *Ident) []*Ident

FindUsages finds usages of given declaration

func (*CompositeLit) FindVarDeclarations

func (s *CompositeLit) FindVarDeclarations() []*Ident

FindVarDeclarations finds all assignStmt (:=), valueSpec (var, const) declarations

func (*CompositeLit) GetScope

func (s *CompositeLit) GetScope() (Node, *types.Scope)

GetScope returns the scope of the node

func (*CompositeLit) GetSource

func (s *CompositeLit) GetSource() []byte

GetSource returns the source code of the current node

func (*CompositeLit) GetSourceString

func (s *CompositeLit) GetSourceString() string

GetSourceString is a convenience function to GetSource as string

func (*CompositeLit) Info

func (s *CompositeLit) Info() *types.Info

Info returns the types.info node.

func (*CompositeLit) IsContainedByType

func (s *CompositeLit) IsContainedByType(nodeType NodeType) bool

IsContainedByType checks if node is contained by a node of given node type

func (*CompositeLit) IsNodeType

func (s *CompositeLit) IsNodeType(nodeType NodeType) bool

IsNodeType checks if node is of given node type

func (*CompositeLit) IsValueType

func (s *CompositeLit) IsValueType(valType string) bool

IsValueType checks if value type is of given type

func (*CompositeLit) Level

func (s *CompositeLit) Level() int

Level returns the level counted from instantiated node = 0

func (*CompositeLit) Match

func (s *CompositeLit) Match(regex regexp.Regexp) bool

Match matches the source code of current node and content with given regex

func (*CompositeLit) NextParentByType

func (s *CompositeLit) NextParentByType(nodeType NodeType) Node

NextParentByType returns the next parent of given type

func (*CompositeLit) NodeType

func (s *CompositeLit) NodeType() NodeType

NodeType returns the NodeType of the node

func (*CompositeLit) Object

func (s *CompositeLit) Object() types.Object

Object returns the object of an identifier, nil otherwise

func (*CompositeLit) Parent

func (s *CompositeLit) Parent() Node

Parent return the parent node

func (*CompositeLit) Parents

func (s *CompositeLit) Parents() []Node

Parents returns the parent path of nodes

func (*CompositeLit) Pkg

func (s *CompositeLit) Pkg() *Package

Pkg returns the package this node belongs to.

func (*CompositeLit) Siblings

func (s *CompositeLit) Siblings() []Node

Siblings returns all sibling nodes

func (*CompositeLit) TreeNode

func (s *CompositeLit) TreeNode(cond func(n Node) bool) Node

TreeNode walks the child tree returning the first node that meets the condition

func (*CompositeLit) TreeNodes

func (s *CompositeLit) TreeNodes(cond func(n Node) bool) []Node

TreeNodes walks the child tree collecting all nodes that meet the condition

func (*CompositeLit) ValueType

func (s *CompositeLit) ValueType() types.Type

ValueType returns the value type of the node.

func (*CompositeLit) Visit

func (s *CompositeLit) Visit(node ast.Node) ast.Visitor

Visit implements the ast.Visitor interface and is used to walk the underlying ast.Node tree

func (*CompositeLit) Walk

func (s *CompositeLit) Walk(f func(node Node) bool)

Walk traverses the tree and its children. return false to skip children of the current element

type DeclStmt

type DeclStmt struct {
	*ast.DeclStmt
	// contains filtered or unexported fields
}

DeclStmt wraps ast.DeclStmt

func (*DeclStmt) AstNode

func (s *DeclStmt) AstNode() ast.Node

AstNode returns the original ast.Node

func (DeclStmt) CallTreeNode

func (s DeclStmt) CallTreeNode(cond func(n Node) bool) Node

CallTreeNode walks the call tree returning the first node that meets the condition

func (DeclStmt) CallTreeNodes

func (s DeclStmt) CallTreeNodes(cond func(n Node) bool) []Node

CallTreeNodes walks the call tree collecting all nodes that meet the condition

func (*DeclStmt) ChildByName

func (s *DeclStmt) ChildByName(name string) Node

ChildByName retrieves a node among the direkt children by name (only nodes that have a name)

func (*DeclStmt) ChildByNodeType

func (s *DeclStmt) ChildByNodeType(nodeType NodeType) Node

ChildByNodeType returns the first child of a certain type.

func (*DeclStmt) ChildNode

func (s *DeclStmt) ChildNode(cond func(n Node) bool) Node

ChildNode walks only child nodes returning the first node that meets the condition

func (*DeclStmt) ChildNodes

func (s *DeclStmt) ChildNodes(cond func(n Node) bool) []Node

ChildNodes walks only child nodes collecting all nodes that meet the condition

func (*DeclStmt) Children

func (s *DeclStmt) Children() []Node

Children returns all child nodes

func (*DeclStmt) ChildrenByNodeType

func (s *DeclStmt) ChildrenByNodeType(nodeType NodeType) []Node

ChildrenByNodeType returns the first child of a certain type.

func (*DeclStmt) Contains

func (s *DeclStmt) Contains(node Node) bool

Contains checks if a node contains another node

func (*DeclStmt) FindByName

func (s *DeclStmt) FindByName(name string) []Node

FindByName looks for a name in the entire sub tree

func (*DeclStmt) FindByNodeType

func (s *DeclStmt) FindByNodeType(nodeType NodeType) []Node

FindByNodeType returns all sub nodes of a certain type

func (*DeclStmt) FindByToken

func (s *DeclStmt) FindByToken(t token.Token) []Node

FindByToken finds a node with a token.Token attached and of given token type

func (*DeclStmt) FindByValueType

func (s *DeclStmt) FindByValueType(valType string) []Node

FindByValueType find all nodes with given value type

func (*DeclStmt) FindDeclarations

func (s *DeclStmt) FindDeclarations() []*Ident

FindDeclarations finds all declarations

func (*DeclStmt) FindDeclarationsByType

func (s *DeclStmt) FindDeclarationsByType(nodeType NodeType) []*Ident

FindDeclarationsByType finds all declarations by (parent) type

func (*DeclStmt) FindFirstByName

func (s *DeclStmt) FindFirstByName(name string) Node

FindFirstByName looks for a name in the entire sub tree. First node is returned if there are multiple.

func (*DeclStmt) FindFirstByNodeType

func (s *DeclStmt) FindFirstByNodeType(nodeType NodeType) Node

FindFirstByNodeType returns the first sub node of a certain type

func (*DeclStmt) FindFirstIdentByName

func (s *DeclStmt) FindFirstIdentByName(name string) *Ident

FindFirstIdentByName looks for the first Ident node in subtree with given name

func (*DeclStmt) FindFirstUsage

func (s *DeclStmt) FindFirstUsage(declaration *Ident) *Ident

FindFirstUsage selects the first usage

func (*DeclStmt) FindIdentByName

func (s *DeclStmt) FindIdentByName(name string) []*Ident

FindIdentByName looks for Ident nodes in the entire sub tree with given name

func (*DeclStmt) FindMaps

func (s *DeclStmt) FindMaps() []Node

FindMaps find all nodes with given value type

func (*DeclStmt) FindNameInCallTree

func (s *DeclStmt) FindNameInCallTree(name string) []Node

FindNameInCallTree returns all nodes in call tree with given name

func (*DeclStmt) FindNodeTypeInCallTree

func (s *DeclStmt) FindNodeTypeInCallTree(nodeType NodeType) []Node

FindNodeTypeInCallTree returns all nodes in call tree of a certain type

func (*DeclStmt) FindUsages

func (s *DeclStmt) FindUsages(declaration *Ident) []*Ident

FindUsages finds usages of given declaration

func (*DeclStmt) FindVarDeclarations

func (s *DeclStmt) FindVarDeclarations() []*Ident

FindVarDeclarations finds all assignStmt (:=), valueSpec (var, const) declarations

func (*DeclStmt) GetScope

func (s *DeclStmt) GetScope() (Node, *types.Scope)

GetScope returns the scope of the node

func (*DeclStmt) GetSource

func (s *DeclStmt) GetSource() []byte

GetSource returns the source code of the current node

func (*DeclStmt) GetSourceString

func (s *DeclStmt) GetSourceString() string

GetSourceString is a convenience function to GetSource as string

func (*DeclStmt) Info

func (s *DeclStmt) Info() *types.Info

Info returns the types.info node.

func (*DeclStmt) IsContainedByType

func (s *DeclStmt) IsContainedByType(nodeType NodeType) bool

IsContainedByType checks if node is contained by a node of given node type

func (*DeclStmt) IsNodeType

func (s *DeclStmt) IsNodeType(nodeType NodeType) bool

IsNodeType checks if node is of given node type

func (*DeclStmt) IsValueType

func (s *DeclStmt) IsValueType(valType string) bool

IsValueType checks if value type is of given type

func (*DeclStmt) Level

func (s *DeclStmt) Level() int

Level returns the level counted from instantiated node = 0

func (*DeclStmt) Match

func (s *DeclStmt) Match(regex regexp.Regexp) bool

Match matches the source code of current node and content with given regex

func (*DeclStmt) NextParentByType

func (s *DeclStmt) NextParentByType(nodeType NodeType) Node

NextParentByType returns the next parent of given type

func (*DeclStmt) NodeType

func (s *DeclStmt) NodeType() NodeType

NodeType returns the NodeType of the node

func (*DeclStmt) Object

func (s *DeclStmt) Object() types.Object

Object returns the object of an identifier, nil otherwise

func (*DeclStmt) Parent

func (s *DeclStmt) Parent() Node

Parent return the parent node

func (*DeclStmt) Parents

func (s *DeclStmt) Parents() []Node

Parents returns the parent path of nodes

func (*DeclStmt) Pkg

func (s *DeclStmt) Pkg() *Package

Pkg returns the package this node belongs to.

func (*DeclStmt) Siblings

func (s *DeclStmt) Siblings() []Node

Siblings returns all sibling nodes

func (*DeclStmt) TreeNode

func (s *DeclStmt) TreeNode(cond func(n Node) bool) Node

TreeNode walks the child tree returning the first node that meets the condition

func (*DeclStmt) TreeNodes

func (s *DeclStmt) TreeNodes(cond func(n Node) bool) []Node

TreeNodes walks the child tree collecting all nodes that meet the condition

func (*DeclStmt) ValueType

func (s *DeclStmt) ValueType() types.Type

ValueType returns value type information of an expression, nil otherwise

func (*DeclStmt) Visit

func (s *DeclStmt) Visit(node ast.Node) ast.Visitor

Visit implements the ast.Visitor interface and is used to walk the underlying ast.Node tree

func (*DeclStmt) Walk

func (s *DeclStmt) Walk(f func(node Node) bool)

Walk traverses the tree and its children. return false to skip children of the current element

type DeferStmt

type DeferStmt struct {
	*ast.DeferStmt
	// contains filtered or unexported fields
}

DeferStmt wraps ast.DeferStmt

func (*DeferStmt) AstNode

func (s *DeferStmt) AstNode() ast.Node

AstNode returns the original ast.Node

func (DeferStmt) CallTreeNode

func (s DeferStmt) CallTreeNode(cond func(n Node) bool) Node

CallTreeNode walks the call tree returning the first node that meets the condition

func (DeferStmt) CallTreeNodes

func (s DeferStmt) CallTreeNodes(cond func(n Node) bool) []Node

CallTreeNodes walks the call tree collecting all nodes that meet the condition

func (*DeferStmt) ChildByName

func (s *DeferStmt) ChildByName(name string) Node

ChildByName retrieves a node among the direkt children by name (only nodes that have a name)

func (*DeferStmt) ChildByNodeType

func (s *DeferStmt) ChildByNodeType(nodeType NodeType) Node

ChildByNodeType returns the first child of a certain type.

func (*DeferStmt) ChildNode

func (s *DeferStmt) ChildNode(cond func(n Node) bool) Node

ChildNode walks only child nodes returning the first node that meets the condition

func (*DeferStmt) ChildNodes

func (s *DeferStmt) ChildNodes(cond func(n Node) bool) []Node

ChildNodes walks only child nodes collecting all nodes that meet the condition

func (*DeferStmt) Children

func (s *DeferStmt) Children() []Node

Children returns all child nodes

func (*DeferStmt) ChildrenByNodeType

func (s *DeferStmt) ChildrenByNodeType(nodeType NodeType) []Node

ChildrenByNodeType returns the first child of a certain type.

func (*DeferStmt) Contains

func (s *DeferStmt) Contains(node Node) bool

Contains checks if a node contains another node

func (*DeferStmt) FindByName

func (s *DeferStmt) FindByName(name string) []Node

FindByName looks for a name in the entire sub tree

func (*DeferStmt) FindByNodeType

func (s *DeferStmt) FindByNodeType(nodeType NodeType) []Node

FindByNodeType returns all sub nodes of a certain type

func (*DeferStmt) FindByToken

func (s *DeferStmt) FindByToken(t token.Token) []Node

FindByToken finds a node with a token.Token attached and of given token type

func (*DeferStmt) FindByValueType

func (s *DeferStmt) FindByValueType(valType string) []Node

FindByValueType find all nodes with given value type

func (*DeferStmt) FindDeclarations

func (s *DeferStmt) FindDeclarations() []*Ident

FindDeclarations finds all declarations

func (*DeferStmt) FindDeclarationsByType

func (s *DeferStmt) FindDeclarationsByType(nodeType NodeType) []*Ident

FindDeclarationsByType finds all declarations by (parent) type

func (*DeferStmt) FindFirstByName

func (s *DeferStmt) FindFirstByName(name string) Node

FindFirstByName looks for a name in the entire sub tree. First node is returned if there are multiple.

func (*DeferStmt) FindFirstByNodeType

func (s *DeferStmt) FindFirstByNodeType(nodeType NodeType) Node

FindFirstByNodeType returns the first sub node of a certain type

func (*DeferStmt) FindFirstIdentByName

func (s *DeferStmt) FindFirstIdentByName(name string) *Ident

FindFirstIdentByName looks for the first Ident node in subtree with given name

func (*DeferStmt) FindFirstUsage

func (s *DeferStmt) FindFirstUsage(declaration *Ident) *Ident

FindFirstUsage selects the first usage

func (*DeferStmt) FindIdentByName

func (s *DeferStmt) FindIdentByName(name string) []*Ident

FindIdentByName looks for Ident nodes in the entire sub tree with given name

func (*DeferStmt) FindMaps

func (s *DeferStmt) FindMaps() []Node

FindMaps find all nodes with given value type

func (*DeferStmt) FindNameInCallTree

func (s *DeferStmt) FindNameInCallTree(name string) []Node

FindNameInCallTree returns all nodes in call tree with given name

func (*DeferStmt) FindNodeTypeInCallTree

func (s *DeferStmt) FindNodeTypeInCallTree(nodeType NodeType) []Node

FindNodeTypeInCallTree returns all nodes in call tree of a certain type

func (*DeferStmt) FindUsages

func (s *DeferStmt) FindUsages(declaration *Ident) []*Ident

FindUsages finds usages of given declaration

func (*DeferStmt) FindVarDeclarations

func (s *DeferStmt) FindVarDeclarations() []*Ident

FindVarDeclarations finds all assignStmt (:=), valueSpec (var, const) declarations

func (*DeferStmt) GetScope

func (s *DeferStmt) GetScope() (Node, *types.Scope)

GetScope returns the scope of the node

func (*DeferStmt) GetSource

func (s *DeferStmt) GetSource() []byte

GetSource returns the source code of the current node

func (*DeferStmt) GetSourceString

func (s *DeferStmt) GetSourceString() string

GetSourceString is a convenience function to GetSource as string

func (*DeferStmt) Info

func (s *DeferStmt) Info() *types.Info

Info returns the types.info node.

func (*DeferStmt) IsContainedByType

func (s *DeferStmt) IsContainedByType(nodeType NodeType) bool

IsContainedByType checks if node is contained by a node of given node type

func (*DeferStmt) IsNodeType

func (s *DeferStmt) IsNodeType(nodeType NodeType) bool

IsNodeType checks if node is of given node type

func (*DeferStmt) IsValueType

func (s *DeferStmt) IsValueType(valType string) bool

IsValueType checks if value type is of given type

func (*DeferStmt) Level

func (s *DeferStmt) Level() int

Level returns the level counted from instantiated node = 0

func (*DeferStmt) Match

func (s *DeferStmt) Match(regex regexp.Regexp) bool

Match matches the source code of current node and content with given regex

func (*DeferStmt) NextParentByType

func (s *DeferStmt) NextParentByType(nodeType NodeType) Node

NextParentByType returns the next parent of given type

func (*DeferStmt) NodeType

func (s *DeferStmt) NodeType() NodeType

NodeType returns the NodeType of the node

func (*DeferStmt) Object

func (s *DeferStmt) Object() types.Object

Object returns the object of an identifier, nil otherwise

func (*DeferStmt) Parent

func (s *DeferStmt) Parent() Node

Parent return the parent node

func (*DeferStmt) Parents

func (s *DeferStmt) Parents() []Node

Parents returns the parent path of nodes

func (*DeferStmt) Pkg

func (s *DeferStmt) Pkg() *Package

Pkg returns the package this node belongs to.

func (*DeferStmt) Siblings

func (s *DeferStmt) Siblings() []Node

Siblings returns all sibling nodes

func (*DeferStmt) TreeNode

func (s *DeferStmt) TreeNode(cond func(n Node) bool) Node

TreeNode walks the child tree returning the first node that meets the condition

func (*DeferStmt) TreeNodes

func (s *DeferStmt) TreeNodes(cond func(n Node) bool) []Node

TreeNodes walks the child tree collecting all nodes that meet the condition

func (*DeferStmt) ValueType

func (s *DeferStmt) ValueType() types.Type

ValueType returns value type information of an expression, nil otherwise

func (*DeferStmt) Visit

func (s *DeferStmt) Visit(node ast.Node) ast.Visitor

Visit implements the ast.Visitor interface and is used to walk the underlying ast.Node tree

func (*DeferStmt) Walk

func (s *DeferStmt) Walk(f func(node Node) bool)

Walk traverses the tree and its children. return false to skip children of the current element

type Ellipsis

type Ellipsis struct {
	*ast.Ellipsis
	// contains filtered or unexported fields
}

Ellipsis wraps ast.Ellipsis

func (*Ellipsis) AstNode

func (s *Ellipsis) AstNode() ast.Node

AstNode returns the original ast.Node

func (Ellipsis) CallTreeNode

func (s Ellipsis) CallTreeNode(cond func(n Node) bool) Node

CallTreeNode walks the call tree returning the first node that meets the condition

func (Ellipsis) CallTreeNodes

func (s Ellipsis) CallTreeNodes(cond func(n Node) bool) []Node

CallTreeNodes walks the call tree collecting all nodes that meet the condition

func (*Ellipsis) ChildByName

func (s *Ellipsis) ChildByName(name string) Node

ChildByName retrieves a node among the direkt children by name (only nodes that have a name)

func (*Ellipsis) ChildByNodeType

func (s *Ellipsis) ChildByNodeType(nodeType NodeType) Node

ChildByNodeType returns the first child of a certain type.

func (*Ellipsis) ChildNode

func (s *Ellipsis) ChildNode(cond func(n Node) bool) Node

ChildNode walks only child nodes returning the first node that meets the condition

func (*Ellipsis) ChildNodes

func (s *Ellipsis) ChildNodes(cond func(n Node) bool) []Node

ChildNodes walks only child nodes collecting all nodes that meet the condition

func (*Ellipsis) Children

func (s *Ellipsis) Children() []Node

Children returns all child nodes

func (*Ellipsis) ChildrenByNodeType

func (s *Ellipsis) ChildrenByNodeType(nodeType NodeType) []Node

ChildrenByNodeType returns the first child of a certain type.

func (*Ellipsis) Contains

func (s *Ellipsis) Contains(node Node) bool

Contains checks if a node contains another node

func (*Ellipsis) FindByName

func (s *Ellipsis) FindByName(name string) []Node

FindByName looks for a name in the entire sub tree

func (*Ellipsis) FindByNodeType

func (s *Ellipsis) FindByNodeType(nodeType NodeType) []Node

FindByNodeType returns all sub nodes of a certain type

func (*Ellipsis) FindByToken

func (s *Ellipsis) FindByToken(t token.Token) []Node

FindByToken finds a node with a token.Token attached and of given token type

func (*Ellipsis) FindByValueType

func (s *Ellipsis) FindByValueType(valType string) []Node

FindByValueType find all nodes with given value type

func (*Ellipsis) FindDeclarations

func (s *Ellipsis) FindDeclarations() []*Ident

FindDeclarations finds all declarations

func (*Ellipsis) FindDeclarationsByType

func (s *Ellipsis) FindDeclarationsByType(nodeType NodeType) []*Ident

FindDeclarationsByType finds all declarations by (parent) type

func (*Ellipsis) FindFirstByName

func (s *Ellipsis) FindFirstByName(name string) Node

FindFirstByName looks for a name in the entire sub tree. First node is returned if there are multiple.

func (*Ellipsis) FindFirstByNodeType

func (s *Ellipsis) FindFirstByNodeType(nodeType NodeType) Node

FindFirstByNodeType returns the first sub node of a certain type

func (*Ellipsis) FindFirstIdentByName

func (s *Ellipsis) FindFirstIdentByName(name string) *Ident

FindFirstIdentByName looks for the first Ident node in subtree with given name

func (*Ellipsis) FindFirstUsage

func (s *Ellipsis) FindFirstUsage(declaration *Ident) *Ident

FindFirstUsage selects the first usage

func (*Ellipsis) FindIdentByName

func (s *Ellipsis) FindIdentByName(name string) []*Ident

FindIdentByName looks for Ident nodes in the entire sub tree with given name

func (*Ellipsis) FindMaps

func (s *Ellipsis) FindMaps() []Node

FindMaps find all nodes with given value type

func (*Ellipsis) FindNameInCallTree

func (s *Ellipsis) FindNameInCallTree(name string) []Node

FindNameInCallTree returns all nodes in call tree with given name

func (*Ellipsis) FindNodeTypeInCallTree

func (s *Ellipsis) FindNodeTypeInCallTree(nodeType NodeType) []Node

FindNodeTypeInCallTree returns all nodes in call tree of a certain type

func (*Ellipsis) FindUsages

func (s *Ellipsis) FindUsages(declaration *Ident) []*Ident

FindUsages finds usages of given declaration

func (*Ellipsis) FindVarDeclarations

func (s *Ellipsis) FindVarDeclarations() []*Ident

FindVarDeclarations finds all assignStmt (:=), valueSpec (var, const) declarations

func (*Ellipsis) GetScope

func (s *Ellipsis) GetScope() (Node, *types.Scope)

GetScope returns the scope of the node

func (*Ellipsis) GetSource

func (s *Ellipsis) GetSource() []byte

GetSource returns the source code of the current node

func (*Ellipsis) GetSourceString

func (s *Ellipsis) GetSourceString() string

GetSourceString is a convenience function to GetSource as string

func (*Ellipsis) Info

func (s *Ellipsis) Info() *types.Info

Info returns the types.info node.

func (*Ellipsis) IsContainedByType

func (s *Ellipsis) IsContainedByType(nodeType NodeType) bool

IsContainedByType checks if node is contained by a node of given node type

func (*Ellipsis) IsNodeType

func (s *Ellipsis) IsNodeType(nodeType NodeType) bool

IsNodeType checks if node is of given node type

func (*Ellipsis) IsValueType

func (s *Ellipsis) IsValueType(valType string) bool

IsValueType checks if value type is of given type

func (*Ellipsis) Level

func (s *Ellipsis) Level() int

Level returns the level counted from instantiated node = 0

func (*Ellipsis) Match

func (s *Ellipsis) Match(regex regexp.Regexp) bool

Match matches the source code of current node and content with given regex

func (*Ellipsis) NextParentByType

func (s *Ellipsis) NextParentByType(nodeType NodeType) Node

NextParentByType returns the next parent of given type

func (*Ellipsis) NodeType

func (s *Ellipsis) NodeType() NodeType

NodeType returns the NodeType of the node

func (*Ellipsis) Object

func (s *Ellipsis) Object() types.Object

Object returns the object of an identifier, nil otherwise

func (*Ellipsis) Parent

func (s *Ellipsis) Parent() Node

Parent return the parent node

func (*Ellipsis) Parents

func (s *Ellipsis) Parents() []Node

Parents returns the parent path of nodes

func (*Ellipsis) Pkg

func (s *Ellipsis) Pkg() *Package

Pkg returns the package this node belongs to.

func (*Ellipsis) Siblings

func (s *Ellipsis) Siblings() []Node

Siblings returns all sibling nodes

func (*Ellipsis) TreeNode

func (s *Ellipsis) TreeNode(cond func(n Node) bool) Node

TreeNode walks the child tree returning the first node that meets the condition

func (*Ellipsis) TreeNodes

func (s *Ellipsis) TreeNodes(cond func(n Node) bool) []Node

TreeNodes walks the child tree collecting all nodes that meet the condition

func (*Ellipsis) ValueType

func (s *Ellipsis) ValueType() types.Type

ValueType returns value type information of an expression, nil otherwise

func (*Ellipsis) Visit

func (s *Ellipsis) Visit(node ast.Node) ast.Visitor

Visit implements the ast.Visitor interface and is used to walk the underlying ast.Node tree

func (*Ellipsis) Walk

func (s *Ellipsis) Walk(f func(node Node) bool)

Walk traverses the tree and its children. return false to skip children of the current element

type EmptyStmt

type EmptyStmt struct {
	*ast.EmptyStmt
	// contains filtered or unexported fields
}

EmptyStmt wraps ast.EmptyStmt

func (*EmptyStmt) AstNode

func (s *EmptyStmt) AstNode() ast.Node

AstNode returns the original ast.Node

func (EmptyStmt) CallTreeNode

func (s EmptyStmt) CallTreeNode(cond func(n Node) bool) Node

CallTreeNode walks the call tree returning the first node that meets the condition

func (EmptyStmt) CallTreeNodes

func (s EmptyStmt) CallTreeNodes(cond func(n Node) bool) []Node

CallTreeNodes walks the call tree collecting all nodes that meet the condition

func (*EmptyStmt) ChildByName

func (s *EmptyStmt) ChildByName(name string) Node

ChildByName retrieves a node among the direkt children by name (only nodes that have a name)

func (*EmptyStmt) ChildByNodeType

func (s *EmptyStmt) ChildByNodeType(nodeType NodeType) Node

ChildByNodeType returns the first child of a certain type.

func (*EmptyStmt) ChildNode

func (s *EmptyStmt) ChildNode(cond func(n Node) bool) Node

ChildNode walks only child nodes returning the first node that meets the condition

func (*EmptyStmt) ChildNodes

func (s *EmptyStmt) ChildNodes(cond func(n Node) bool) []Node

ChildNodes walks only child nodes collecting all nodes that meet the condition

func (*EmptyStmt) Children

func (s *EmptyStmt) Children() []Node

Children returns all child nodes

func (*EmptyStmt) ChildrenByNodeType

func (s *EmptyStmt) ChildrenByNodeType(nodeType NodeType) []Node

ChildrenByNodeType returns the first child of a certain type.

func (*EmptyStmt) Contains

func (s *EmptyStmt) Contains(node Node) bool

Contains checks if a node contains another node

func (*EmptyStmt) FindByName

func (s *EmptyStmt) FindByName(name string) []Node

FindByName looks for a name in the entire sub tree

func (*EmptyStmt) FindByNodeType

func (s *EmptyStmt) FindByNodeType(nodeType NodeType) []Node

FindByNodeType returns all sub nodes of a certain type

func (*EmptyStmt) FindByToken

func (s *EmptyStmt) FindByToken(t token.Token) []Node

FindByToken finds a node with a token.Token attached and of given token type

func (*EmptyStmt) FindByValueType

func (s *EmptyStmt) FindByValueType(valType string) []Node

FindByValueType find all nodes with given value type

func (*EmptyStmt) FindDeclarations

func (s *EmptyStmt) FindDeclarations() []*Ident

FindDeclarations finds all declarations

func (*EmptyStmt) FindDeclarationsByType

func (s *EmptyStmt) FindDeclarationsByType(nodeType NodeType) []*Ident

FindDeclarationsByType finds all declarations by (parent) type

func (*EmptyStmt) FindFirstByName

func (s *EmptyStmt) FindFirstByName(name string) Node

FindFirstByName looks for a name in the entire sub tree. First node is returned if there are multiple.

func (*EmptyStmt) FindFirstByNodeType

func (s *EmptyStmt) FindFirstByNodeType(nodeType NodeType) Node

FindFirstByNodeType returns the first sub node of a certain type

func (*EmptyStmt) FindFirstIdentByName

func (s *EmptyStmt) FindFirstIdentByName(name string) *Ident

FindFirstIdentByName looks for the first Ident node in subtree with given name

func (*EmptyStmt) FindFirstUsage

func (s *EmptyStmt) FindFirstUsage(declaration *Ident) *Ident

FindFirstUsage selects the first usage

func (*EmptyStmt) FindIdentByName

func (s *EmptyStmt) FindIdentByName(name string) []*Ident

FindIdentByName looks for Ident nodes in the entire sub tree with given name

func (*EmptyStmt) FindMaps

func (s *EmptyStmt) FindMaps() []Node

FindMaps find all nodes with given value type

func (*EmptyStmt) FindNameInCallTree

func (s *EmptyStmt) FindNameInCallTree(name string) []Node

FindNameInCallTree returns all nodes in call tree with given name

func (*EmptyStmt) FindNodeTypeInCallTree

func (s *EmptyStmt) FindNodeTypeInCallTree(nodeType NodeType) []Node

FindNodeTypeInCallTree returns all nodes in call tree of a certain type

func (*EmptyStmt) FindUsages

func (s *EmptyStmt) FindUsages(declaration *Ident) []*Ident

FindUsages finds usages of given declaration

func (*EmptyStmt) FindVarDeclarations

func (s *EmptyStmt) FindVarDeclarations() []*Ident

FindVarDeclarations finds all assignStmt (:=), valueSpec (var, const) declarations

func (*EmptyStmt) GetScope

func (s *EmptyStmt) GetScope() (Node, *types.Scope)

GetScope returns the scope of the node

func (*EmptyStmt) GetSource

func (s *EmptyStmt) GetSource() []byte

GetSource returns the source code of the current node

func (*EmptyStmt) GetSourceString

func (s *EmptyStmt) GetSourceString() string

GetSourceString is a convenience function to GetSource as string

func (*EmptyStmt) Info

func (s *EmptyStmt) Info() *types.Info

Info returns the types.info node.

func (*EmptyStmt) IsContainedByType

func (s *EmptyStmt) IsContainedByType(nodeType NodeType) bool

IsContainedByType checks if node is contained by a node of given node type

func (*EmptyStmt) IsNodeType

func (s *EmptyStmt) IsNodeType(nodeType NodeType) bool

IsNodeType checks if node is of given node type

func (*EmptyStmt) IsValueType

func (s *EmptyStmt) IsValueType(valType string) bool

IsValueType checks if value type is of given type

func (*EmptyStmt) Level

func (s *EmptyStmt) Level() int

Level returns the level counted from instantiated node = 0

func (*EmptyStmt) Match

func (s *EmptyStmt) Match(regex regexp.Regexp) bool

Match matches the source code of current node and content with given regex

func (*EmptyStmt) NextParentByType

func (s *EmptyStmt) NextParentByType(nodeType NodeType) Node

NextParentByType returns the next parent of given type

func (*EmptyStmt) NodeType

func (s *EmptyStmt) NodeType() NodeType

NodeType returns the NodeType of the node

func (*EmptyStmt) Object

func (s *EmptyStmt) Object() types.Object

Object returns the object of an identifier, nil otherwise

func (*EmptyStmt) Parent

func (s *EmptyStmt) Parent() Node

Parent return the parent node

func (*EmptyStmt) Parents

func (s *EmptyStmt) Parents() []Node

Parents returns the parent path of nodes

func (*EmptyStmt) Pkg

func (s *EmptyStmt) Pkg() *Package

Pkg returns the package this node belongs to.

func (*EmptyStmt) Siblings

func (s *EmptyStmt) Siblings() []Node

Siblings returns all sibling nodes

func (*EmptyStmt) TreeNode

func (s *EmptyStmt) TreeNode(cond func(n Node) bool) Node

TreeNode walks the child tree returning the first node that meets the condition

func (*EmptyStmt) TreeNodes

func (s *EmptyStmt) TreeNodes(cond func(n Node) bool) []Node

TreeNodes walks the child tree collecting all nodes that meet the condition

func (*EmptyStmt) ValueType

func (s *EmptyStmt) ValueType() types.Type

ValueType returns value type information of an expression, nil otherwise

func (*EmptyStmt) Visit

func (s *EmptyStmt) Visit(node ast.Node) ast.Visitor

Visit implements the ast.Visitor interface and is used to walk the underlying ast.Node tree

func (*EmptyStmt) Walk

func (s *EmptyStmt) Walk(f func(node Node) bool)

Walk traverses the tree and its children. return false to skip children of the current element

type ExprStmt

type ExprStmt struct {
	*ast.ExprStmt
	// contains filtered or unexported fields
}

ExprStmt wraps ast.ExprStmt

func (*ExprStmt) AstNode

func (s *ExprStmt) AstNode() ast.Node

AstNode returns the original ast.Node

func (ExprStmt) CallTreeNode

func (s ExprStmt) CallTreeNode(cond func(n Node) bool) Node

CallTreeNode walks the call tree returning the first node that meets the condition

func (ExprStmt) CallTreeNodes

func (s ExprStmt) CallTreeNodes(cond func(n Node) bool) []Node

CallTreeNodes walks the call tree collecting all nodes that meet the condition

func (*ExprStmt) ChildByName

func (s *ExprStmt) ChildByName(name string) Node

ChildByName retrieves a node among the direkt children by name (only nodes that have a name)

func (*ExprStmt) ChildByNodeType

func (s *ExprStmt) ChildByNodeType(nodeType NodeType) Node

ChildByNodeType returns the first child of a certain type.

func (*ExprStmt) ChildNode

func (s *ExprStmt) ChildNode(cond func(n Node) bool) Node

ChildNode walks only child nodes returning the first node that meets the condition

func (*ExprStmt) ChildNodes

func (s *ExprStmt) ChildNodes(cond func(n Node) bool) []Node

ChildNodes walks only child nodes collecting all nodes that meet the condition

func (*ExprStmt) Children

func (s *ExprStmt) Children() []Node

Children returns all child nodes

func (*ExprStmt) ChildrenByNodeType

func (s *ExprStmt) ChildrenByNodeType(nodeType NodeType) []Node

ChildrenByNodeType returns the first child of a certain type.

func (*ExprStmt) Contains

func (s *ExprStmt) Contains(node Node) bool

Contains checks if a node contains another node

func (*ExprStmt) FindByName

func (s *ExprStmt) FindByName(name string) []Node

FindByName looks for a name in the entire sub tree

func (*ExprStmt) FindByNodeType

func (s *ExprStmt) FindByNodeType(nodeType NodeType) []Node

FindByNodeType returns all sub nodes of a certain type

func (*ExprStmt) FindByToken

func (s *ExprStmt) FindByToken(t token.Token) []Node

FindByToken finds a node with a token.Token attached and of given token type

func (*ExprStmt) FindByValueType

func (s *ExprStmt) FindByValueType(valType string) []Node

FindByValueType find all nodes with given value type

func (*ExprStmt) FindDeclarations

func (s *ExprStmt) FindDeclarations() []*Ident

FindDeclarations finds all declarations

func (*ExprStmt) FindDeclarationsByType

func (s *ExprStmt) FindDeclarationsByType(nodeType NodeType) []*Ident

FindDeclarationsByType finds all declarations by (parent) type

func (*ExprStmt) FindFirstByName

func (s *ExprStmt) FindFirstByName(name string) Node

FindFirstByName looks for a name in the entire sub tree. First node is returned if there are multiple.

func (*ExprStmt) FindFirstByNodeType

func (s *ExprStmt) FindFirstByNodeType(nodeType NodeType) Node

FindFirstByNodeType returns the first sub node of a certain type

func (*ExprStmt) FindFirstIdentByName

func (s *ExprStmt) FindFirstIdentByName(name string) *Ident

FindFirstIdentByName looks for the first Ident node in subtree with given name

func (*ExprStmt) FindFirstUsage

func (s *ExprStmt) FindFirstUsage(declaration *Ident) *Ident

FindFirstUsage selects the first usage

func (*ExprStmt) FindIdentByName

func (s *ExprStmt) FindIdentByName(name string) []*Ident

FindIdentByName looks for Ident nodes in the entire sub tree with given name

func (*ExprStmt) FindMaps

func (s *ExprStmt) FindMaps() []Node

FindMaps find all nodes with given value type

func (*ExprStmt) FindNameInCallTree

func (s *ExprStmt) FindNameInCallTree(name string) []Node

FindNameInCallTree returns all nodes in call tree with given name

func (*ExprStmt) FindNodeTypeInCallTree

func (s *ExprStmt) FindNodeTypeInCallTree(nodeType NodeType) []Node

FindNodeTypeInCallTree returns all nodes in call tree of a certain type

func (*ExprStmt) FindUsages

func (s *ExprStmt) FindUsages(declaration *Ident) []*Ident

FindUsages finds usages of given declaration

func (*ExprStmt) FindVarDeclarations

func (s *ExprStmt) FindVarDeclarations() []*Ident

FindVarDeclarations finds all assignStmt (:=), valueSpec (var, const) declarations

func (*ExprStmt) GetScope

func (s *ExprStmt) GetScope() (Node, *types.Scope)

GetScope returns the scope of the node

func (*ExprStmt) GetSource

func (s *ExprStmt) GetSource() []byte

GetSource returns the source code of the current node

func (*ExprStmt) GetSourceString

func (s *ExprStmt) GetSourceString() string

GetSourceString is a convenience function to GetSource as string

func (*ExprStmt) Info

func (s *ExprStmt) Info() *types.Info

Info returns the types.info node.

func (*ExprStmt) IsContainedByType

func (s *ExprStmt) IsContainedByType(nodeType NodeType) bool

IsContainedByType checks if node is contained by a node of given node type

func (*ExprStmt) IsNodeType

func (s *ExprStmt) IsNodeType(nodeType NodeType) bool

IsNodeType checks if node is of given node type

func (*ExprStmt) IsValueType

func (s *ExprStmt) IsValueType(valType string) bool

IsValueType checks if value type is of given type

func (*ExprStmt) Level

func (s *ExprStmt) Level() int

Level returns the level counted from instantiated node = 0

func (*ExprStmt) Match

func (s *ExprStmt) Match(regex regexp.Regexp) bool

Match matches the source code of current node and content with given regex

func (*ExprStmt) NextParentByType

func (s *ExprStmt) NextParentByType(nodeType NodeType) Node

NextParentByType returns the next parent of given type

func (*ExprStmt) NodeType

func (s *ExprStmt) NodeType() NodeType

NodeType returns the NodeType of the node

func (*ExprStmt) Object

func (s *ExprStmt) Object() types.Object

Object returns the object of an identifier, nil otherwise

func (*ExprStmt) Parent

func (s *ExprStmt) Parent() Node

Parent return the parent node

func (*ExprStmt) Parents

func (s *ExprStmt) Parents() []Node

Parents returns the parent path of nodes

func (*ExprStmt) Pkg

func (s *ExprStmt) Pkg() *Package

Pkg returns the package this node belongs to.

func (*ExprStmt) Siblings

func (s *ExprStmt) Siblings() []Node

Siblings returns all sibling nodes

func (*ExprStmt) TreeNode

func (s *ExprStmt) TreeNode(cond func(n Node) bool) Node

TreeNode walks the child tree returning the first node that meets the condition

func (*ExprStmt) TreeNodes

func (s *ExprStmt) TreeNodes(cond func(n Node) bool) []Node

TreeNodes walks the child tree collecting all nodes that meet the condition

func (*ExprStmt) ValueType

func (s *ExprStmt) ValueType() types.Type

ValueType returns value type information of an expression, nil otherwise

func (*ExprStmt) Visit

func (s *ExprStmt) Visit(node ast.Node) ast.Visitor

Visit implements the ast.Visitor interface and is used to walk the underlying ast.Node tree

func (*ExprStmt) Walk

func (s *ExprStmt) Walk(f func(node Node) bool)

Walk traverses the tree and its children. return false to skip children of the current element

type Field

type Field struct {
	*ast.Field
	// contains filtered or unexported fields
}

Field wraps ast.Field

func (*Field) AstNode

func (s *Field) AstNode() ast.Node

AstNode returns the original ast.Node

func (Field) CallTreeNode

func (s Field) CallTreeNode(cond func(n Node) bool) Node

CallTreeNode walks the call tree returning the first node that meets the condition

func (Field) CallTreeNodes

func (s Field) CallTreeNodes(cond func(n Node) bool) []Node

CallTreeNodes walks the call tree collecting all nodes that meet the condition

func (*Field) ChildByName

func (s *Field) ChildByName(name string) Node

ChildByName retrieves a node among the direkt children by name (only nodes that have a name)

func (*Field) ChildByNodeType

func (s *Field) ChildByNodeType(nodeType NodeType) Node

ChildByNodeType returns the first child of a certain type.

func (*Field) ChildNode

func (s *Field) ChildNode(cond func(n Node) bool) Node

ChildNode walks only child nodes returning the first node that meets the condition

func (*Field) ChildNodes

func (s *Field) ChildNodes(cond func(n Node) bool) []Node

ChildNodes walks only child nodes collecting all nodes that meet the condition

func (*Field) Children

func (s *Field) Children() []Node

Children returns all child nodes

func (*Field) ChildrenByNodeType

func (s *Field) ChildrenByNodeType(nodeType NodeType) []Node

ChildrenByNodeType returns the first child of a certain type.

func (*Field) Contains

func (s *Field) Contains(node Node) bool

Contains checks if a node contains another node

func (*Field) FindByName

func (s *Field) FindByName(name string) []Node

FindByName looks for a name in the entire sub tree

func (*Field) FindByNodeType

func (s *Field) FindByNodeType(nodeType NodeType) []Node

FindByNodeType returns all sub nodes of a certain type

func (*Field) FindByToken

func (s *Field) FindByToken(t token.Token) []Node

FindByToken finds a node with a token.Token attached and of given token type

func (*Field) FindByValueType

func (s *Field) FindByValueType(valType string) []Node

FindByValueType find all nodes with given value type

func (*Field) FindDeclarations

func (s *Field) FindDeclarations() []*Ident

FindDeclarations finds all declarations

func (*Field) FindDeclarationsByType

func (s *Field) FindDeclarationsByType(nodeType NodeType) []*Ident

FindDeclarationsByType finds all declarations by (parent) type

func (*Field) FindFirstByName

func (s *Field) FindFirstByName(name string) Node

FindFirstByName looks for a name in the entire sub tree. First node is returned if there are multiple.

func (*Field) FindFirstByNodeType

func (s *Field) FindFirstByNodeType(nodeType NodeType) Node

FindFirstByNodeType returns the first sub node of a certain type

func (*Field) FindFirstIdentByName

func (s *Field) FindFirstIdentByName(name string) *Ident

FindFirstIdentByName looks for the first Ident node in subtree with given name

func (*Field) FindFirstUsage

func (s *Field) FindFirstUsage(declaration *Ident) *Ident

FindFirstUsage selects the first usage

func (*Field) FindIdentByName

func (s *Field) FindIdentByName(name string) []*Ident

FindIdentByName looks for Ident nodes in the entire sub tree with given name

func (*Field) FindMaps

func (s *Field) FindMaps() []Node

FindMaps find all nodes with given value type

func (*Field) FindNameInCallTree

func (s *Field) FindNameInCallTree(name string) []Node

FindNameInCallTree returns all nodes in call tree with given name

func (*Field) FindNodeTypeInCallTree

func (s *Field) FindNodeTypeInCallTree(nodeType NodeType) []Node

FindNodeTypeInCallTree returns all nodes in call tree of a certain type

func (*Field) FindUsages

func (s *Field) FindUsages(declaration *Ident) []*Ident

FindUsages finds usages of given declaration

func (*Field) FindVarDeclarations

func (s *Field) FindVarDeclarations() []*Ident

FindVarDeclarations finds all assignStmt (:=), valueSpec (var, const) declarations

func (*Field) GetIdent

func (s *Field) GetIdent() *Ident

GetIdent returns the name of the node

func (*Field) GetScope

func (s *Field) GetScope() (Node, *types.Scope)

GetScope returns the scope of the node

func (*Field) GetSource

func (s *Field) GetSource() []byte

GetSource returns the source code of the current node

func (*Field) GetSourceString

func (s *Field) GetSourceString() string

GetSourceString is a convenience function to GetSource as string

func (*Field) Info

func (s *Field) Info() *types.Info

Info returns the types.info node.

func (*Field) IsContainedByType

func (s *Field) IsContainedByType(nodeType NodeType) bool

IsContainedByType checks if node is contained by a node of given node type

func (*Field) IsNodeType

func (s *Field) IsNodeType(nodeType NodeType) bool

IsNodeType checks if node is of given node type

func (*Field) IsValueType

func (s *Field) IsValueType(valType string) bool

IsValueType checks if value type is of given type

func (*Field) Level

func (s *Field) Level() int

Level returns the level counted from instantiated node = 0

func (*Field) Match

func (s *Field) Match(regex regexp.Regexp) bool

Match matches the source code of current node and content with given regex

func (*Field) NextParentByType

func (s *Field) NextParentByType(nodeType NodeType) Node

NextParentByType returns the next parent of given type

func (*Field) NodeName

func (s *Field) NodeName() string

NodeName returns the name of the node

func (*Field) NodeType

func (s *Field) NodeType() NodeType

NodeType returns the NodeType of the node

func (*Field) Object

func (s *Field) Object() types.Object

Object returns the object of an identifier, nil otherwise

func (*Field) Parent

func (s *Field) Parent() Node

Parent return the parent node

func (*Field) Parents

func (s *Field) Parents() []Node

Parents returns the parent path of nodes

func (*Field) Pkg

func (s *Field) Pkg() *Package

Pkg returns the package this node belongs to.

func (*Field) Siblings

func (s *Field) Siblings() []Node

Siblings returns all sibling nodes

func (*Field) TreeNode

func (s *Field) TreeNode(cond func(n Node) bool) Node

TreeNode walks the child tree returning the first node that meets the condition

func (*Field) TreeNodes

func (s *Field) TreeNodes(cond func(n Node) bool) []Node

TreeNodes walks the child tree collecting all nodes that meet the condition

func (*Field) ValueType

func (s *Field) ValueType() types.Type

ValueType returns the value type of the node.

func (*Field) Visit

func (s *Field) Visit(node ast.Node) ast.Visitor

Visit implements the ast.Visitor interface and is used to walk the underlying ast.Node tree

func (*Field) Walk

func (s *Field) Walk(f func(node Node) bool)

Walk traverses the tree and its children. return false to skip children of the current element

type FieldList

type FieldList struct {
	*ast.FieldList
	// contains filtered or unexported fields
}

FieldList wraps ast.FieldList

func (*FieldList) AstNode

func (s *FieldList) AstNode() ast.Node

AstNode returns the original ast.Node

func (FieldList) CallTreeNode

func (s FieldList) CallTreeNode(cond func(n Node) bool) Node

CallTreeNode walks the call tree returning the first node that meets the condition

func (FieldList) CallTreeNodes

func (s FieldList) CallTreeNodes(cond func(n Node) bool) []Node

CallTreeNodes walks the call tree collecting all nodes that meet the condition

func (*FieldList) ChildByName

func (s *FieldList) ChildByName(name string) Node

ChildByName retrieves a node among the direkt children by name (only nodes that have a name)

func (*FieldList) ChildByNodeType

func (s *FieldList) ChildByNodeType(nodeType NodeType) Node

ChildByNodeType returns the first child of a certain type.

func (*FieldList) ChildNode

func (s *FieldList) ChildNode(cond func(n Node) bool) Node

ChildNode walks only child nodes returning the first node that meets the condition

func (*FieldList) ChildNodes

func (s *FieldList) ChildNodes(cond func(n Node) bool) []Node

ChildNodes walks only child nodes collecting all nodes that meet the condition

func (*FieldList) Children

func (s *FieldList) Children() []Node

Children returns all child nodes

func (*FieldList) ChildrenByNodeType

func (s *FieldList) ChildrenByNodeType(nodeType NodeType) []Node

ChildrenByNodeType returns the first child of a certain type.

func (*FieldList) Contains

func (s *FieldList) Contains(node Node) bool

Contains checks if a node contains another node

func (*FieldList) FindByName

func (s *FieldList) FindByName(name string) []Node

FindByName looks for a name in the entire sub tree

func (*FieldList) FindByNodeType

func (s *FieldList) FindByNodeType(nodeType NodeType) []Node

FindByNodeType returns all sub nodes of a certain type

func (*FieldList) FindByToken

func (s *FieldList) FindByToken(t token.Token) []Node

FindByToken finds a node with a token.Token attached and of given token type

func (*FieldList) FindByValueType

func (s *FieldList) FindByValueType(valType string) []Node

FindByValueType find all nodes with given value type

func (*FieldList) FindDeclarations

func (s *FieldList) FindDeclarations() []*Ident

FindDeclarations finds all declarations

func (*FieldList) FindDeclarationsByType

func (s *FieldList) FindDeclarationsByType(nodeType NodeType) []*Ident

FindDeclarationsByType finds all declarations by (parent) type

func (*FieldList) FindFirstByName

func (s *FieldList) FindFirstByName(name string) Node

FindFirstByName looks for a name in the entire sub tree. First node is returned if there are multiple.

func (*FieldList) FindFirstByNodeType

func (s *FieldList) FindFirstByNodeType(nodeType NodeType) Node

FindFirstByNodeType returns the first sub node of a certain type

func (*FieldList) FindFirstIdentByName

func (s *FieldList) FindFirstIdentByName(name string) *Ident

FindFirstIdentByName looks for the first Ident node in subtree with given name

func (*FieldList) FindFirstUsage

func (s *FieldList) FindFirstUsage(declaration *Ident) *Ident

FindFirstUsage selects the first usage

func (*FieldList) FindIdentByName

func (s *FieldList) FindIdentByName(name string) []*Ident

FindIdentByName looks for Ident nodes in the entire sub tree with given name

func (*FieldList) FindMaps

func (s *FieldList) FindMaps() []Node

FindMaps find all nodes with given value type

func (*FieldList) FindNameInCallTree

func (s *FieldList) FindNameInCallTree(name string) []Node

FindNameInCallTree returns all nodes in call tree with given name

func (*FieldList) FindNodeTypeInCallTree

func (s *FieldList) FindNodeTypeInCallTree(nodeType NodeType) []Node

FindNodeTypeInCallTree returns all nodes in call tree of a certain type

func (*FieldList) FindUsages

func (s *FieldList) FindUsages(declaration *Ident) []*Ident

FindUsages finds usages of given declaration

func (*FieldList) FindVarDeclarations

func (s *FieldList) FindVarDeclarations() []*Ident

FindVarDeclarations finds all assignStmt (:=), valueSpec (var, const) declarations

func (*FieldList) GetScope

func (s *FieldList) GetScope() (Node, *types.Scope)

GetScope returns the scope of the node

func (*FieldList) GetSource

func (s *FieldList) GetSource() []byte

GetSource returns the source code of the current node

func (*FieldList) GetSourceString

func (s *FieldList) GetSourceString() string

GetSourceString is a convenience function to GetSource as string

func (*FieldList) Info

func (s *FieldList) Info() *types.Info

Info returns the types.info node.

func (*FieldList) IsContainedByType

func (s *FieldList) IsContainedByType(nodeType NodeType) bool

IsContainedByType checks if node is contained by a node of given node type

func (*FieldList) IsNodeType

func (s *FieldList) IsNodeType(nodeType NodeType) bool

IsNodeType checks if node is of given node type

func (*FieldList) IsValueType

func (s *FieldList) IsValueType(valType string) bool

IsValueType checks if value type is of given type

func (*FieldList) Level

func (s *FieldList) Level() int

Level returns the level counted from instantiated node = 0

func (*FieldList) Match

func (s *FieldList) Match(regex regexp.Regexp) bool

Match matches the source code of current node and content with given regex

func (*FieldList) NextParentByType

func (s *FieldList) NextParentByType(nodeType NodeType) Node

NextParentByType returns the next parent of given type

func (*FieldList) NodeType

func (s *FieldList) NodeType() NodeType

NodeType returns the NodeType of the node

func (*FieldList) Object

func (s *FieldList) Object() types.Object

Object returns the object of an identifier, nil otherwise

func (*FieldList) Parent

func (s *FieldList) Parent() Node

Parent return the parent node

func (*FieldList) Parents

func (s *FieldList) Parents() []Node

Parents returns the parent path of nodes

func (*FieldList) Pkg

func (s *FieldList) Pkg() *Package

Pkg returns the package this node belongs to.

func (*FieldList) Siblings

func (s *FieldList) Siblings() []Node

Siblings returns all sibling nodes

func (*FieldList) TreeNode

func (s *FieldList) TreeNode(cond func(n Node) bool) Node

TreeNode walks the child tree returning the first node that meets the condition

func (*FieldList) TreeNodes

func (s *FieldList) TreeNodes(cond func(n Node) bool) []Node

TreeNodes walks the child tree collecting all nodes that meet the condition

func (*FieldList) ValueType

func (s *FieldList) ValueType() types.Type

ValueType returns value type information of an expression, nil otherwise

func (*FieldList) Visit

func (s *FieldList) Visit(node ast.Node) ast.Visitor

Visit implements the ast.Visitor interface and is used to walk the underlying ast.Node tree

func (*FieldList) Walk

func (s *FieldList) Walk(f func(node Node) bool)

Walk traverses the tree and its children. return false to skip children of the current element

type File

type File struct {
	*ast.File
	// contains filtered or unexported fields
}

File wraps ast.File

func NewFile

func NewFile(file string, fset *token.FileSet) (*File, error)

NewFile creates a new file from file path

func NewFileNode

func NewFileNode(node *ast.File, rawFile *RawFile) *File

NewFileNode creates a new file node including raw content for regex searches. Use NewNode to create a file without regex capabilities.

func (*File) AstNode

func (s *File) AstNode() ast.Node

AstNode returns the original ast.Node

func (File) CallTreeNode

func (s File) CallTreeNode(cond func(n Node) bool) Node

CallTreeNode walks the call tree returning the first node that meets the condition

func (File) CallTreeNodes

func (s File) CallTreeNodes(cond func(n Node) bool) []Node

CallTreeNodes walks the call tree collecting all nodes that meet the condition

func (*File) ChildByName

func (s *File) ChildByName(name string) Node

ChildByName retrieves a node among the direkt children by name (only nodes that have a name)

func (*File) ChildByNodeType

func (s *File) ChildByNodeType(nodeType NodeType) Node

ChildByNodeType returns the first child of a certain type.

func (*File) ChildNode

func (s *File) ChildNode(cond func(n Node) bool) Node

ChildNode walks only child nodes returning the first node that meets the condition

func (*File) ChildNodes

func (s *File) ChildNodes(cond func(n Node) bool) []Node

ChildNodes walks only child nodes collecting all nodes that meet the condition

func (*File) Children

func (s *File) Children() []Node

Children returns all child nodes

func (*File) ChildrenByNodeType

func (s *File) ChildrenByNodeType(nodeType NodeType) []Node

ChildrenByNodeType returns the first child of a certain type.

func (*File) Contains

func (s *File) Contains(node Node) bool

Contains checks if a node contains another node

func (*File) FindByName

func (s *File) FindByName(name string) []Node

FindByName looks for a name in the entire sub tree

func (*File) FindByNodeType

func (s *File) FindByNodeType(nodeType NodeType) []Node

FindByNodeType returns all sub nodes of a certain type

func (*File) FindByToken

func (s *File) FindByToken(t token.Token) []Node

FindByToken finds a node with a token.Token attached and of given token type

func (*File) FindByValueType

func (s *File) FindByValueType(valType string) []Node

FindByValueType find all nodes with given value type

func (*File) FindDeclarations

func (s *File) FindDeclarations() []*Ident

FindDeclarations finds all declarations

func (*File) FindDeclarationsByType

func (s *File) FindDeclarationsByType(nodeType NodeType) []*Ident

FindDeclarationsByType finds all declarations by (parent) type

func (*File) FindFirstByName

func (s *File) FindFirstByName(name string) Node

FindFirstByName looks for a name in the entire sub tree. First node is returned if there are multiple.

func (*File) FindFirstByNodeType

func (s *File) FindFirstByNodeType(nodeType NodeType) Node

FindFirstByNodeType returns the first sub node of a certain type

func (*File) FindFirstIdentByName

func (s *File) FindFirstIdentByName(name string) *Ident

FindFirstIdentByName looks for the first Ident node in subtree with given name

func (*File) FindFirstUsage

func (s *File) FindFirstUsage(declaration *Ident) *Ident

FindFirstUsage selects the first usage

func (*File) FindIdentByName

func (s *File) FindIdentByName(name string) []*Ident

FindIdentByName looks for Ident nodes in the entire sub tree with given name

func (*File) FindMaps

func (s *File) FindMaps() []Node

FindMaps find all nodes with given value type

func (*File) FindNameInCallTree

func (s *File) FindNameInCallTree(name string) []Node

FindNameInCallTree returns all nodes in call tree with given name

func (*File) FindNodeTypeInCallTree

func (s *File) FindNodeTypeInCallTree(nodeType NodeType) []Node

FindNodeTypeInCallTree returns all nodes in call tree of a certain type

func (*File) FindUsages

func (s *File) FindUsages(declaration *Ident) []*Ident

FindUsages finds usages of given declaration

func (*File) FindVarDeclarations

func (s *File) FindVarDeclarations() []*Ident

FindVarDeclarations finds all assignStmt (:=), valueSpec (var, const) declarations

func (*File) GetIdent

func (s *File) GetIdent() *Ident

GetIdent returns the name of the node

func (*File) GetScope

func (s *File) GetScope() (Node, *types.Scope)

GetScope returns the scope of the node

func (*File) GetSource

func (s *File) GetSource() []byte

GetSource returns the source code of the current node

func (*File) GetSourceString

func (s *File) GetSourceString() string

GetSourceString is a convenience function to GetSource as string

func (*File) Info

func (s *File) Info() *types.Info

Info returns the types.info node.

func (*File) IsContainedByType

func (s *File) IsContainedByType(nodeType NodeType) bool

IsContainedByType checks if node is contained by a node of given node type

func (*File) IsNodeType

func (s *File) IsNodeType(nodeType NodeType) bool

IsNodeType checks if node is of given node type

func (*File) IsValueType

func (s *File) IsValueType(valType string) bool

IsValueType checks if value type is of given type

func (*File) Level

func (s *File) Level() int

Level returns the level counted from instantiated node = 0

func (*File) Match

func (s *File) Match(regex regexp.Regexp) bool

Match matches the source code of current node and content with given regex

func (*File) NextParentByType

func (s *File) NextParentByType(nodeType NodeType) Node

NextParentByType returns the next parent of given type

func (*File) NodeName

func (s *File) NodeName() string

NodeName returns the name of the node

func (*File) NodeType

func (s *File) NodeType() NodeType

NodeType returns the NodeType of the node

func (*File) Object

func (s *File) Object() types.Object

Object returns the object of an identifier, nil otherwise

func (*File) Parent

func (s *File) Parent() Node

Parent return the parent node

func (*File) Parents

func (s *File) Parents() []Node

Parents returns the parent path of nodes

func (*File) Pkg

func (s *File) Pkg() *Package

Pkg returns the package this node belongs to.

func (*File) Siblings

func (s *File) Siblings() []Node

Siblings returns all sibling nodes

func (*File) TreeNode

func (s *File) TreeNode(cond func(n Node) bool) Node

TreeNode walks the child tree returning the first node that meets the condition

func (*File) TreeNodes

func (s *File) TreeNodes(cond func(n Node) bool) []Node

TreeNodes walks the child tree collecting all nodes that meet the condition

func (*File) ValueType

func (s *File) ValueType() types.Type

ValueType returns value type information of an expression, nil otherwise

func (*File) Visit

func (s *File) Visit(node ast.Node) ast.Visitor

Visit implements the ast.Visitor interface and is used to walk the underlying ast.Node tree

func (*File) Walk

func (s *File) Walk(f func(node Node) bool)

Walk traverses the tree and its children. return false to skip children of the current element

type Folder

type Folder struct {
	Info     *types.Info
	FSet     *token.FileSet
	Pkgs     map[string]*Package
	Pkg      *types.Package
	RawFiles map[string]*RawFile
	// contains filtered or unexported fields
}

Folder represents a go package folder

func NewFolder

func NewFolder(root http.FileSystem, dir string) *Folder

NewFolder creates a new folder with given path. Use ParseFolder to parse ast from go files in path. The pkgPath is the import path of the package to be used by types.ParseInfo.

func (*Folder) GetPath

func (s *Folder) GetPath() string

GetPath returns the pkg import path.

func (*Folder) GetRawFiles

func (s *Folder) GetRawFiles() map[string][]byte

GetRawFiles a map of file contents

func (*Folder) Package

func (s *Folder) Package(name string) *Package

Package returns a package by name

func (*Folder) ParseFolder

func (s *Folder) ParseFolder() (map[string]*Package, error)

ParseFolder will parse all to files in folder. It skips test files.

func (*Folder) ParseInfo

func (s *Folder) ParseInfo(path string, fSet *token.FileSet, files []*ast.File) (*types.Package, error)

ParseInfo parses all files for type information which is then available from the Nodes. When using Folder.ParseFolder, this is done automatically.

type ForStmt

type ForStmt struct {
	*ast.ForStmt
	// contains filtered or unexported fields
}

ForStmt wraps ast.ForStmt

func (*ForStmt) AstNode

func (s *ForStmt) AstNode() ast.Node

AstNode returns the original ast.Node

func (ForStmt) CallTreeNode

func (s ForStmt) CallTreeNode(cond func(n Node) bool) Node

CallTreeNode walks the call tree returning the first node that meets the condition

func (ForStmt) CallTreeNodes

func (s ForStmt) CallTreeNodes(cond func(n Node) bool) []Node

CallTreeNodes walks the call tree collecting all nodes that meet the condition

func (*ForStmt) ChildByName

func (s *ForStmt) ChildByName(name string) Node

ChildByName retrieves a node among the direkt children by name (only nodes that have a name)

func (*ForStmt) ChildByNodeType

func (s *ForStmt) ChildByNodeType(nodeType NodeType) Node

ChildByNodeType returns the first child of a certain type.

func (*ForStmt) ChildNode

func (s *ForStmt) ChildNode(cond func(n Node) bool) Node

ChildNode walks only child nodes returning the first node that meets the condition

func (*ForStmt) ChildNodes

func (s *ForStmt) ChildNodes(cond func(n Node) bool) []Node

ChildNodes walks only child nodes collecting all nodes that meet the condition

func (*ForStmt) Children

func (s *ForStmt) Children() []Node

Children returns all child nodes

func (*ForStmt) ChildrenByNodeType

func (s *ForStmt) ChildrenByNodeType(nodeType NodeType) []Node

ChildrenByNodeType returns the first child of a certain type.

func (*ForStmt) Cond

func (s *ForStmt) Cond() Node

Cond returns the condition node of the for loop

func (*ForStmt) Contains

func (s *ForStmt) Contains(node Node) bool

Contains checks if a node contains another node

func (*ForStmt) FindByName

func (s *ForStmt) FindByName(name string) []Node

FindByName looks for a name in the entire sub tree

func (*ForStmt) FindByNodeType

func (s *ForStmt) FindByNodeType(nodeType NodeType) []Node

FindByNodeType returns all sub nodes of a certain type

func (*ForStmt) FindByToken

func (s *ForStmt) FindByToken(t token.Token) []Node

FindByToken finds a node with a token.Token attached and of given token type

func (*ForStmt) FindByValueType

func (s *ForStmt) FindByValueType(valType string) []Node

FindByValueType find all nodes with given value type

func (*ForStmt) FindDeclarations

func (s *ForStmt) FindDeclarations() []*Ident

FindDeclarations finds all declarations

func (*ForStmt) FindDeclarationsByType

func (s *ForStmt) FindDeclarationsByType(nodeType NodeType) []*Ident

FindDeclarationsByType finds all declarations by (parent) type

func (*ForStmt) FindFirstByName

func (s *ForStmt) FindFirstByName(name string) Node

FindFirstByName looks for a name in the entire sub tree. First node is returned if there are multiple.

func (*ForStmt) FindFirstByNodeType

func (s *ForStmt) FindFirstByNodeType(nodeType NodeType) Node

FindFirstByNodeType returns the first sub node of a certain type

func (*ForStmt) FindFirstIdentByName

func (s *ForStmt) FindFirstIdentByName(name string) *Ident

FindFirstIdentByName looks for the first Ident node in subtree with given name

func (*ForStmt) FindFirstUsage

func (s *ForStmt) FindFirstUsage(declaration *Ident) *Ident

FindFirstUsage selects the first usage

func (*ForStmt) FindIdentByName

func (s *ForStmt) FindIdentByName(name string) []*Ident

FindIdentByName looks for Ident nodes in the entire sub tree with given name

func (*ForStmt) FindMaps

func (s *ForStmt) FindMaps() []Node

FindMaps find all nodes with given value type

func (*ForStmt) FindNameInCallTree

func (s *ForStmt) FindNameInCallTree(name string) []Node

FindNameInCallTree returns all nodes in call tree with given name

func (*ForStmt) FindNodeTypeInCallTree

func (s *ForStmt) FindNodeTypeInCallTree(nodeType NodeType) []Node

FindNodeTypeInCallTree returns all nodes in call tree of a certain type

func (*ForStmt) FindUsages

func (s *ForStmt) FindUsages(declaration *Ident) []*Ident

FindUsages finds usages of given declaration

func (*ForStmt) FindVarDeclarations

func (s *ForStmt) FindVarDeclarations() []*Ident

FindVarDeclarations finds all assignStmt (:=), valueSpec (var, const) declarations

func (*ForStmt) GetScope

func (s *ForStmt) GetScope() (Node, *types.Scope)

GetScope returns the scope of the node

func (*ForStmt) GetSource

func (s *ForStmt) GetSource() []byte

GetSource returns the source code of the current node

func (*ForStmt) GetSourceString

func (s *ForStmt) GetSourceString() string

GetSourceString is a convenience function to GetSource as string

func (*ForStmt) Info

func (s *ForStmt) Info() *types.Info

Info returns the types.info node.

func (*ForStmt) Init

func (s *ForStmt) Init() Node

Init returns the init node of the for loop

func (*ForStmt) IsContainedByType

func (s *ForStmt) IsContainedByType(nodeType NodeType) bool

IsContainedByType checks if node is contained by a node of given node type

func (*ForStmt) IsNodeType

func (s *ForStmt) IsNodeType(nodeType NodeType) bool

IsNodeType checks if node is of given node type

func (*ForStmt) IsValueType

func (s *ForStmt) IsValueType(valType string) bool

IsValueType checks if value type is of given type

func (*ForStmt) Level

func (s *ForStmt) Level() int

Level returns the level counted from instantiated node = 0

func (*ForStmt) Match

func (s *ForStmt) Match(regex regexp.Regexp) bool

Match matches the source code of current node and content with given regex

func (*ForStmt) NextParentByType

func (s *ForStmt) NextParentByType(nodeType NodeType) Node

NextParentByType returns the next parent of given type

func (*ForStmt) NodeType

func (s *ForStmt) NodeType() NodeType

NodeType returns the NodeType of the node

func (*ForStmt) Object

func (s *ForStmt) Object() types.Object

Object returns the object of an identifier, nil otherwise

func (*ForStmt) Parent

func (s *ForStmt) Parent() Node

Parent return the parent node

func (*ForStmt) Parents

func (s *ForStmt) Parents() []Node

Parents returns the parent path of nodes

func (*ForStmt) Pkg

func (s *ForStmt) Pkg() *Package

Pkg returns the package this node belongs to.

func (*ForStmt) Post

func (s *ForStmt) Post() Node

Post returns the post iteration node of the for loop

func (*ForStmt) Siblings

func (s *ForStmt) Siblings() []Node

Siblings returns all sibling nodes

func (*ForStmt) TreeNode

func (s *ForStmt) TreeNode(cond func(n Node) bool) Node

TreeNode walks the child tree returning the first node that meets the condition

func (*ForStmt) TreeNodes

func (s *ForStmt) TreeNodes(cond func(n Node) bool) []Node

TreeNodes walks the child tree collecting all nodes that meet the condition

func (*ForStmt) ValueType

func (s *ForStmt) ValueType() types.Type

ValueType returns value type information of an expression, nil otherwise

func (*ForStmt) Visit

func (s *ForStmt) Visit(node ast.Node) ast.Visitor

Visit implements the ast.Visitor interface and is used to walk the underlying ast.Node tree

func (*ForStmt) Walk

func (s *ForStmt) Walk(f func(node Node) bool)

Walk traverses the tree and its children. return false to skip children of the current element

type FuncDecl

type FuncDecl struct {
	*ast.FuncDecl
	// contains filtered or unexported fields
}

FuncDecl wraps ast.FuncDecl

func (*FuncDecl) AstNode

func (s *FuncDecl) AstNode() ast.Node

AstNode returns the original ast.Node

func (FuncDecl) CallTreeNode

func (s FuncDecl) CallTreeNode(cond func(n Node) bool) Node

CallTreeNode walks the call tree returning the first node that meets the condition

func (FuncDecl) CallTreeNodes

func (s FuncDecl) CallTreeNodes(cond func(n Node) bool) []Node

CallTreeNodes walks the call tree collecting all nodes that meet the condition

func (*FuncDecl) ChildByName

func (s *FuncDecl) ChildByName(name string) Node

ChildByName retrieves a node among the direkt children by name (only nodes that have a name)

func (*FuncDecl) ChildByNodeType

func (s *FuncDecl) ChildByNodeType(nodeType NodeType) Node

ChildByNodeType returns the first child of a certain type.

func (*FuncDecl) ChildNode

func (s *FuncDecl) ChildNode(cond func(n Node) bool) Node

ChildNode walks only child nodes returning the first node that meets the condition

func (*FuncDecl) ChildNodes

func (s *FuncDecl) ChildNodes(cond func(n Node) bool) []Node

ChildNodes walks only child nodes collecting all nodes that meet the condition

func (*FuncDecl) Children

func (s *FuncDecl) Children() []Node

Children returns all child nodes

func (*FuncDecl) ChildrenByNodeType

func (s *FuncDecl) ChildrenByNodeType(nodeType NodeType) []Node

ChildrenByNodeType returns the first child of a certain type.

func (*FuncDecl) Contains

func (s *FuncDecl) Contains(node Node) bool

Contains checks if a node contains another node

func (*FuncDecl) FindByName

func (s *FuncDecl) FindByName(name string) []Node

FindByName looks for a name in the entire sub tree

func (*FuncDecl) FindByNodeType

func (s *FuncDecl) FindByNodeType(nodeType NodeType) []Node

FindByNodeType returns all sub nodes of a certain type

func (*FuncDecl) FindByToken

func (s *FuncDecl) FindByToken(t token.Token) []Node

FindByToken finds a node with a token.Token attached and of given token type

func (*FuncDecl) FindByValueType

func (s *FuncDecl) FindByValueType(valType string) []Node

FindByValueType find all nodes with given value type

func (*FuncDecl) FindDeclarations

func (s *FuncDecl) FindDeclarations() []*Ident

FindDeclarations finds all declarations

func (*FuncDecl) FindDeclarationsByType

func (s *FuncDecl) FindDeclarationsByType(nodeType NodeType) []*Ident

FindDeclarationsByType finds all declarations by (parent) type

func (*FuncDecl) FindFirstByName

func (s *FuncDecl) FindFirstByName(name string) Node

FindFirstByName looks for a name in the entire sub tree. First node is returned if there are multiple.

func (*FuncDecl) FindFirstByNodeType

func (s *FuncDecl) FindFirstByNodeType(nodeType NodeType) Node

FindFirstByNodeType returns the first sub node of a certain type

func (*FuncDecl) FindFirstIdentByName

func (s *FuncDecl) FindFirstIdentByName(name string) *Ident

FindFirstIdentByName looks for the first Ident node in subtree with given name

func (*FuncDecl) FindFirstUsage

func (s *FuncDecl) FindFirstUsage(declaration *Ident) *Ident

FindFirstUsage selects the first usage

func (*FuncDecl) FindIdentByName

func (s *FuncDecl) FindIdentByName(name string) []*Ident

FindIdentByName looks for Ident nodes in the entire sub tree with given name

func (*FuncDecl) FindMaps

func (s *FuncDecl) FindMaps() []Node

FindMaps find all nodes with given value type

func (*FuncDecl) FindNameInCallTree

func (s *FuncDecl) FindNameInCallTree(name string) []Node

FindNameInCallTree returns all nodes in call tree with given name

func (*FuncDecl) FindNodeTypeInCallTree

func (s *FuncDecl) FindNodeTypeInCallTree(nodeType NodeType) []Node

FindNodeTypeInCallTree returns all nodes in call tree of a certain type

func (*FuncDecl) FindUsages

func (s *FuncDecl) FindUsages(declaration *Ident) []*Ident

FindUsages finds usages of given declaration

func (*FuncDecl) FindVarDeclarations

func (s *FuncDecl) FindVarDeclarations() []*Ident

FindVarDeclarations finds all assignStmt (:=), valueSpec (var, const) declarations

func (*FuncDecl) GetIdent

func (s *FuncDecl) GetIdent() *Ident

GetIdent returns the name of the node

func (*FuncDecl) GetScope

func (s *FuncDecl) GetScope() (Node, *types.Scope)

GetScope returns the scope of the node

func (*FuncDecl) GetSource

func (s *FuncDecl) GetSource() []byte

GetSource returns the source code of the current node

func (*FuncDecl) GetSourceString

func (s *FuncDecl) GetSourceString() string

GetSourceString is a convenience function to GetSource as string

func (*FuncDecl) Info

func (s *FuncDecl) Info() *types.Info

Info returns the types.info node.

func (*FuncDecl) IsContainedByType

func (s *FuncDecl) IsContainedByType(nodeType NodeType) bool

IsContainedByType checks if node is contained by a node of given node type

func (*FuncDecl) IsNodeType

func (s *FuncDecl) IsNodeType(nodeType NodeType) bool

IsNodeType checks if node is of given node type

func (*FuncDecl) IsValueType

func (s *FuncDecl) IsValueType(valType string) bool

IsValueType checks if value type is of given type

func (*FuncDecl) Level

func (s *FuncDecl) Level() int

Level returns the level counted from instantiated node = 0

func (*FuncDecl) Match

func (s *FuncDecl) Match(regex regexp.Regexp) bool

Match matches the source code of current node and content with given regex

func (*FuncDecl) NextParentByType

func (s *FuncDecl) NextParentByType(nodeType NodeType) Node

NextParentByType returns the next parent of given type

func (*FuncDecl) NodeName

func (s *FuncDecl) NodeName() string

NodeName returns the name of the node

func (*FuncDecl) NodeType

func (s *FuncDecl) NodeType() NodeType

NodeType returns the NodeType of the node

func (*FuncDecl) Object

func (s *FuncDecl) Object() types.Object

Object returns the object of an identifier, nil otherwise

func (*FuncDecl) Params

func (s *FuncDecl) Params() *FieldList

Params returns the parameter FieldList

func (*FuncDecl) Parent

func (s *FuncDecl) Parent() Node

Parent return the parent node

func (*FuncDecl) Parents

func (s *FuncDecl) Parents() []Node

Parents returns the parent path of nodes

func (*FuncDecl) Pkg

func (s *FuncDecl) Pkg() *Package

Pkg returns the package this node belongs to.

func (*FuncDecl) Results

func (s *FuncDecl) Results() *FieldList

Results returns the return parameter FieldList

func (*FuncDecl) Siblings

func (s *FuncDecl) Siblings() []Node

Siblings returns all sibling nodes

func (*FuncDecl) TreeNode

func (s *FuncDecl) TreeNode(cond func(n Node) bool) Node

TreeNode walks the child tree returning the first node that meets the condition

func (*FuncDecl) TreeNodes

func (s *FuncDecl) TreeNodes(cond func(n Node) bool) []Node

TreeNodes walks the child tree collecting all nodes that meet the condition

func (*FuncDecl) ValueType

func (s *FuncDecl) ValueType() types.Type

ValueType returns value type information of an expression, nil otherwise

func (*FuncDecl) Visit

func (s *FuncDecl) Visit(node ast.Node) ast.Visitor

Visit implements the ast.Visitor interface and is used to walk the underlying ast.Node tree

func (*FuncDecl) Walk

func (s *FuncDecl) Walk(f func(node Node) bool)

Walk traverses the tree and its children. return false to skip children of the current element

type FuncLit

type FuncLit struct {
	*ast.FuncLit
	// contains filtered or unexported fields
}

FuncLit wraps ast.FuncLit

func (*FuncLit) AstNode

func (s *FuncLit) AstNode() ast.Node

AstNode returns the original ast.Node

func (FuncLit) CallTreeNode

func (s FuncLit) CallTreeNode(cond func(n Node) bool) Node

CallTreeNode walks the call tree returning the first node that meets the condition

func (FuncLit) CallTreeNodes

func (s FuncLit) CallTreeNodes(cond func(n Node) bool) []Node

CallTreeNodes walks the call tree collecting all nodes that meet the condition

func (*FuncLit) ChildByName

func (s *FuncLit) ChildByName(name string) Node

ChildByName retrieves a node among the direkt children by name (only nodes that have a name)

func (*FuncLit) ChildByNodeType

func (s *FuncLit) ChildByNodeType(nodeType NodeType) Node

ChildByNodeType returns the first child of a certain type.

func (*FuncLit) ChildNode

func (s *FuncLit) ChildNode(cond func(n Node) bool) Node

ChildNode walks only child nodes returning the first node that meets the condition

func (*FuncLit) ChildNodes

func (s *FuncLit) ChildNodes(cond func(n Node) bool) []Node

ChildNodes walks only child nodes collecting all nodes that meet the condition

func (*FuncLit) Children

func (s *FuncLit) Children() []Node

Children returns all child nodes

func (*FuncLit) ChildrenByNodeType

func (s *FuncLit) ChildrenByNodeType(nodeType NodeType) []Node

ChildrenByNodeType returns the first child of a certain type.

func (*FuncLit) Contains

func (s *FuncLit) Contains(node Node) bool

Contains checks if a node contains another node

func (*FuncLit) FindByName

func (s *FuncLit) FindByName(name string) []Node

FindByName looks for a name in the entire sub tree

func (*FuncLit) FindByNodeType

func (s *FuncLit) FindByNodeType(nodeType NodeType) []Node

FindByNodeType returns all sub nodes of a certain type

func (*FuncLit) FindByToken

func (s *FuncLit) FindByToken(t token.Token) []Node

FindByToken finds a node with a token.Token attached and of given token type

func (*FuncLit) FindByValueType

func (s *FuncLit) FindByValueType(valType string) []Node

FindByValueType find all nodes with given value type

func (*FuncLit) FindDeclarations

func (s *FuncLit) FindDeclarations() []*Ident

FindDeclarations finds all declarations

func (*FuncLit) FindDeclarationsByType

func (s *FuncLit) FindDeclarationsByType(nodeType NodeType) []*Ident

FindDeclarationsByType finds all declarations by (parent) type

func (*FuncLit) FindFirstByName

func (s *FuncLit) FindFirstByName(name string) Node

FindFirstByName looks for a name in the entire sub tree. First node is returned if there are multiple.

func (*FuncLit) FindFirstByNodeType

func (s *FuncLit) FindFirstByNodeType(nodeType NodeType) Node

FindFirstByNodeType returns the first sub node of a certain type

func (*FuncLit) FindFirstIdentByName

func (s *FuncLit) FindFirstIdentByName(name string) *Ident

FindFirstIdentByName looks for the first Ident node in subtree with given name

func (*FuncLit) FindFirstUsage

func (s *FuncLit) FindFirstUsage(declaration *Ident) *Ident

FindFirstUsage selects the first usage

func (*FuncLit) FindIdentByName

func (s *FuncLit) FindIdentByName(name string) []*Ident

FindIdentByName looks for Ident nodes in the entire sub tree with given name

func (*FuncLit) FindMaps

func (s *FuncLit) FindMaps() []Node

FindMaps find all nodes with given value type

func (*FuncLit) FindNameInCallTree

func (s *FuncLit) FindNameInCallTree(name string) []Node

FindNameInCallTree returns all nodes in call tree with given name

func (*FuncLit) FindNodeTypeInCallTree

func (s *FuncLit) FindNodeTypeInCallTree(nodeType NodeType) []Node

FindNodeTypeInCallTree returns all nodes in call tree of a certain type

func (*FuncLit) FindUsages

func (s *FuncLit) FindUsages(declaration *Ident) []*Ident

FindUsages finds usages of given declaration

func (*FuncLit) FindVarDeclarations

func (s *FuncLit) FindVarDeclarations() []*Ident

FindVarDeclarations finds all assignStmt (:=), valueSpec (var, const) declarations

func (*FuncLit) GetScope

func (s *FuncLit) GetScope() (Node, *types.Scope)

GetScope returns the scope of the node

func (*FuncLit) GetSource

func (s *FuncLit) GetSource() []byte

GetSource returns the source code of the current node

func (*FuncLit) GetSourceString

func (s *FuncLit) GetSourceString() string

GetSourceString is a convenience function to GetSource as string

func (*FuncLit) Info

func (s *FuncLit) Info() *types.Info

Info returns the types.info node.

func (*FuncLit) IsContainedByType

func (s *FuncLit) IsContainedByType(nodeType NodeType) bool

IsContainedByType checks if node is contained by a node of given node type

func (*FuncLit) IsNodeType

func (s *FuncLit) IsNodeType(nodeType NodeType) bool

IsNodeType checks if node is of given node type

func (*FuncLit) IsValueType

func (s *FuncLit) IsValueType(valType string) bool

IsValueType checks if value type is of given type

func (*FuncLit) Level

func (s *FuncLit) Level() int

Level returns the level counted from instantiated node = 0

func (*FuncLit) Match

func (s *FuncLit) Match(regex regexp.Regexp) bool

Match matches the source code of current node and content with given regex

func (*FuncLit) NextParentByType

func (s *FuncLit) NextParentByType(nodeType NodeType) Node

NextParentByType returns the next parent of given type

func (*FuncLit) NodeType

func (s *FuncLit) NodeType() NodeType

NodeType returns the NodeType of the node

func (*FuncLit) Object

func (s *FuncLit) Object() types.Object

Object returns the object of an identifier, nil otherwise

func (*FuncLit) Parent

func (s *FuncLit) Parent() Node

Parent return the parent node

func (*FuncLit) Parents

func (s *FuncLit) Parents() []Node

Parents returns the parent path of nodes

func (*FuncLit) Pkg

func (s *FuncLit) Pkg() *Package

Pkg returns the package this node belongs to.

func (*FuncLit) Siblings

func (s *FuncLit) Siblings() []Node

Siblings returns all sibling nodes

func (*FuncLit) TreeNode

func (s *FuncLit) TreeNode(cond func(n Node) bool) Node

TreeNode walks the child tree returning the first node that meets the condition

func (*FuncLit) TreeNodes

func (s *FuncLit) TreeNodes(cond func(n Node) bool) []Node

TreeNodes walks the child tree collecting all nodes that meet the condition

func (*FuncLit) ValueType

func (s *FuncLit) ValueType() types.Type

ValueType returns value type information of an expression, nil otherwise

func (*FuncLit) Visit

func (s *FuncLit) Visit(node ast.Node) ast.Visitor

Visit implements the ast.Visitor interface and is used to walk the underlying ast.Node tree

func (*FuncLit) Walk

func (s *FuncLit) Walk(f func(node Node) bool)

Walk traverses the tree and its children. return false to skip children of the current element

type FuncType

type FuncType struct {
	*ast.FuncType
	// contains filtered or unexported fields
}

FuncType wraps ast.FuncType

func (*FuncType) AstNode

func (s *FuncType) AstNode() ast.Node

AstNode returns the original ast.Node

func (FuncType) CallTreeNode

func (s FuncType) CallTreeNode(cond func(n Node) bool) Node

CallTreeNode walks the call tree returning the first node that meets the condition

func (FuncType) CallTreeNodes

func (s FuncType) CallTreeNodes(cond func(n Node) bool) []Node

CallTreeNodes walks the call tree collecting all nodes that meet the condition

func (*FuncType) ChildByName

func (s *FuncType) ChildByName(name string) Node

ChildByName retrieves a node among the direkt children by name (only nodes that have a name)

func (*FuncType) ChildByNodeType

func (s *FuncType) ChildByNodeType(nodeType NodeType) Node

ChildByNodeType returns the first child of a certain type.

func (*FuncType) ChildNode

func (s *FuncType) ChildNode(cond func(n Node) bool) Node

ChildNode walks only child nodes returning the first node that meets the condition

func (*FuncType) ChildNodes

func (s *FuncType) ChildNodes(cond func(n Node) bool) []Node

ChildNodes walks only child nodes collecting all nodes that meet the condition

func (*FuncType) Children

func (s *FuncType) Children() []Node

Children returns all child nodes

func (*FuncType) ChildrenByNodeType

func (s *FuncType) ChildrenByNodeType(nodeType NodeType) []Node

ChildrenByNodeType returns the first child of a certain type.

func (*FuncType) Contains

func (s *FuncType) Contains(node Node) bool

Contains checks if a node contains another node

func (*FuncType) FindByName

func (s *FuncType) FindByName(name string) []Node

FindByName looks for a name in the entire sub tree

func (*FuncType) FindByNodeType

func (s *FuncType) FindByNodeType(nodeType NodeType) []Node

FindByNodeType returns all sub nodes of a certain type

func (*FuncType) FindByToken

func (s *FuncType) FindByToken(t token.Token) []Node

FindByToken finds a node with a token.Token attached and of given token type

func (*FuncType) FindByValueType

func (s *FuncType) FindByValueType(valType string) []Node

FindByValueType find all nodes with given value type

func (*FuncType) FindDeclarations

func (s *FuncType) FindDeclarations() []*Ident

FindDeclarations finds all declarations

func (*FuncType) FindDeclarationsByType

func (s *FuncType) FindDeclarationsByType(nodeType NodeType) []*Ident

FindDeclarationsByType finds all declarations by (parent) type

func (*FuncType) FindFirstByName

func (s *FuncType) FindFirstByName(name string) Node

FindFirstByName looks for a name in the entire sub tree. First node is returned if there are multiple.

func (*FuncType) FindFirstByNodeType

func (s *FuncType) FindFirstByNodeType(nodeType NodeType) Node

FindFirstByNodeType returns the first sub node of a certain type

func (*FuncType) FindFirstIdentByName

func (s *FuncType) FindFirstIdentByName(name string) *Ident

FindFirstIdentByName looks for the first Ident node in subtree with given name

func (*FuncType) FindFirstUsage

func (s *FuncType) FindFirstUsage(declaration *Ident) *Ident

FindFirstUsage selects the first usage

func (*FuncType) FindIdentByName

func (s *FuncType) FindIdentByName(name string) []*Ident

FindIdentByName looks for Ident nodes in the entire sub tree with given name

func (*FuncType) FindMaps

func (s *FuncType) FindMaps() []Node

FindMaps find all nodes with given value type

func (*FuncType) FindNameInCallTree

func (s *FuncType) FindNameInCallTree(name string) []Node

FindNameInCallTree returns all nodes in call tree with given name

func (*FuncType) FindNodeTypeInCallTree

func (s *FuncType) FindNodeTypeInCallTree(nodeType NodeType) []Node

FindNodeTypeInCallTree returns all nodes in call tree of a certain type

func (*FuncType) FindUsages

func (s *FuncType) FindUsages(declaration *Ident) []*Ident

FindUsages finds usages of given declaration

func (*FuncType) FindVarDeclarations

func (s *FuncType) FindVarDeclarations() []*Ident

FindVarDeclarations finds all assignStmt (:=), valueSpec (var, const) declarations

func (*FuncType) GetScope

func (s *FuncType) GetScope() (Node, *types.Scope)

GetScope returns the scope of the node

func (*FuncType) GetSource

func (s *FuncType) GetSource() []byte

GetSource returns the source code of the current node

func (*FuncType) GetSourceString

func (s *FuncType) GetSourceString() string

GetSourceString is a convenience function to GetSource as string

func (*FuncType) Info

func (s *FuncType) Info() *types.Info

Info returns the types.info node.

func (*FuncType) IsContainedByType

func (s *FuncType) IsContainedByType(nodeType NodeType) bool

IsContainedByType checks if node is contained by a node of given node type

func (*FuncType) IsNodeType

func (s *FuncType) IsNodeType(nodeType NodeType) bool

IsNodeType checks if node is of given node type

func (*FuncType) IsValueType

func (s *FuncType) IsValueType(valType string) bool

IsValueType checks if value type is of given type

func (*FuncType) Level

func (s *FuncType) Level() int

Level returns the level counted from instantiated node = 0

func (*FuncType) Match

func (s *FuncType) Match(regex regexp.Regexp) bool

Match matches the source code of current node and content with given regex

func (*FuncType) NextParentByType

func (s *FuncType) NextParentByType(nodeType NodeType) Node

NextParentByType returns the next parent of given type

func (*FuncType) NodeType

func (s *FuncType) NodeType() NodeType

NodeType returns the NodeType of the node

func (*FuncType) Object

func (s *FuncType) Object() types.Object

Object returns the object of an identifier, nil otherwise

func (*FuncType) Params

func (s *FuncType) Params() *FieldList

Params returns the parameter FieldList

func (*FuncType) Parent

func (s *FuncType) Parent() Node

Parent return the parent node

func (*FuncType) Parents

func (s *FuncType) Parents() []Node

Parents returns the parent path of nodes

func (*FuncType) Pkg

func (s *FuncType) Pkg() *Package

Pkg returns the package this node belongs to.

func (*FuncType) Results

func (s *FuncType) Results() *FieldList

Results returns the return parameter FieldList

func (*FuncType) Siblings

func (s *FuncType) Siblings() []Node

Siblings returns all sibling nodes

func (*FuncType) TreeNode

func (s *FuncType) TreeNode(cond func(n Node) bool) Node

TreeNode walks the child tree returning the first node that meets the condition

func (*FuncType) TreeNodes

func (s *FuncType) TreeNodes(cond func(n Node) bool) []Node

TreeNodes walks the child tree collecting all nodes that meet the condition

func (*FuncType) ValueType

func (s *FuncType) ValueType() types.Type

ValueType returns value type information of an expression, nil otherwise

func (*FuncType) Visit

func (s *FuncType) Visit(node ast.Node) ast.Visitor

Visit implements the ast.Visitor interface and is used to walk the underlying ast.Node tree

func (*FuncType) Walk

func (s *FuncType) Walk(f func(node Node) bool)

Walk traverses the tree and its children. return false to skip children of the current element

type GenDecl

type GenDecl struct {
	*ast.GenDecl
	// contains filtered or unexported fields
}

GenDecl wraps ast.GenDecl

func (*GenDecl) AstNode

func (s *GenDecl) AstNode() ast.Node

AstNode returns the original ast.Node

func (GenDecl) CallTreeNode

func (s GenDecl) CallTreeNode(cond func(n Node) bool) Node

CallTreeNode walks the call tree returning the first node that meets the condition

func (GenDecl) CallTreeNodes

func (s GenDecl) CallTreeNodes(cond func(n Node) bool) []Node

CallTreeNodes walks the call tree collecting all nodes that meet the condition

func (*GenDecl) ChildByName

func (s *GenDecl) ChildByName(name string) Node

ChildByName retrieves a node among the direkt children by name (only nodes that have a name)

func (*GenDecl) ChildByNodeType

func (s *GenDecl) ChildByNodeType(nodeType NodeType) Node

ChildByNodeType returns the first child of a certain type.

func (*GenDecl) ChildNode

func (s *GenDecl) ChildNode(cond func(n Node) bool) Node

ChildNode walks only child nodes returning the first node that meets the condition

func (*GenDecl) ChildNodes

func (s *GenDecl) ChildNodes(cond func(n Node) bool) []Node

ChildNodes walks only child nodes collecting all nodes that meet the condition

func (*GenDecl) Children

func (s *GenDecl) Children() []Node

Children returns all child nodes

func (*GenDecl) ChildrenByNodeType

func (s *GenDecl) ChildrenByNodeType(nodeType NodeType) []Node

ChildrenByNodeType returns the first child of a certain type.

func (*GenDecl) Contains

func (s *GenDecl) Contains(node Node) bool

Contains checks if a node contains another node

func (*GenDecl) FindByName

func (s *GenDecl) FindByName(name string) []Node

FindByName looks for a name in the entire sub tree

func (*GenDecl) FindByNodeType

func (s *GenDecl) FindByNodeType(nodeType NodeType) []Node

FindByNodeType returns all sub nodes of a certain type

func (*GenDecl) FindByToken

func (s *GenDecl) FindByToken(t token.Token) []Node

FindByToken finds a node with a token.Token attached and of given token type

func (*GenDecl) FindByValueType

func (s *GenDecl) FindByValueType(valType string) []Node

FindByValueType find all nodes with given value type

func (*GenDecl) FindDeclarations

func (s *GenDecl) FindDeclarations() []*Ident

FindDeclarations finds all declarations

func (*GenDecl) FindDeclarationsByType

func (s *GenDecl) FindDeclarationsByType(nodeType NodeType) []*Ident

FindDeclarationsByType finds all declarations by (parent) type

func (*GenDecl) FindFirstByName

func (s *GenDecl) FindFirstByName(name string) Node

FindFirstByName looks for a name in the entire sub tree. First node is returned if there are multiple.

func (*GenDecl) FindFirstByNodeType

func (s *GenDecl) FindFirstByNodeType(nodeType NodeType) Node

FindFirstByNodeType returns the first sub node of a certain type

func (*GenDecl) FindFirstIdentByName

func (s *GenDecl) FindFirstIdentByName(name string) *Ident

FindFirstIdentByName looks for the first Ident node in subtree with given name

func (*GenDecl) FindFirstUsage

func (s *GenDecl) FindFirstUsage(declaration *Ident) *Ident

FindFirstUsage selects the first usage

func (*GenDecl) FindIdentByName

func (s *GenDecl) FindIdentByName(name string) []*Ident

FindIdentByName looks for Ident nodes in the entire sub tree with given name

func (*GenDecl) FindMaps

func (s *GenDecl) FindMaps() []Node

FindMaps find all nodes with given value type

func (*GenDecl) FindNameInCallTree

func (s *GenDecl) FindNameInCallTree(name string) []Node

FindNameInCallTree returns all nodes in call tree with given name

func (*GenDecl) FindNodeTypeInCallTree

func (s *GenDecl) FindNodeTypeInCallTree(nodeType NodeType) []Node

FindNodeTypeInCallTree returns all nodes in call tree of a certain type

func (*GenDecl) FindUsages

func (s *GenDecl) FindUsages(declaration *Ident) []*Ident

FindUsages finds usages of given declaration

func (*GenDecl) FindVarDeclarations

func (s *GenDecl) FindVarDeclarations() []*Ident

FindVarDeclarations finds all assignStmt (:=), valueSpec (var, const) declarations

func (*GenDecl) GetScope

func (s *GenDecl) GetScope() (Node, *types.Scope)

GetScope returns the scope of the node

func (*GenDecl) GetSource

func (s *GenDecl) GetSource() []byte

GetSource returns the source code of the current node

func (*GenDecl) GetSourceString

func (s *GenDecl) GetSourceString() string

GetSourceString is a convenience function to GetSource as string

func (*GenDecl) Info

func (s *GenDecl) Info() *types.Info

Info returns the types.info node.

func (*GenDecl) IsContainedByType

func (s *GenDecl) IsContainedByType(nodeType NodeType) bool

IsContainedByType checks if node is contained by a node of given node type

func (*GenDecl) IsNodeType

func (s *GenDecl) IsNodeType(nodeType NodeType) bool

IsNodeType checks if node is of given node type

func (*GenDecl) IsValueType

func (s *GenDecl) IsValueType(valType string) bool

IsValueType checks if value type is of given type

func (*GenDecl) Level

func (s *GenDecl) Level() int

Level returns the level counted from instantiated node = 0

func (*GenDecl) Match

func (s *GenDecl) Match(regex regexp.Regexp) bool

Match matches the source code of current node and content with given regex

func (*GenDecl) NextParentByType

func (s *GenDecl) NextParentByType(nodeType NodeType) Node

NextParentByType returns the next parent of given type

func (*GenDecl) NodeType

func (s *GenDecl) NodeType() NodeType

NodeType returns the NodeType of the node

func (*GenDecl) Object

func (s *GenDecl) Object() types.Object

Object returns the object of an identifier, nil otherwise

func (*GenDecl) Parent

func (s *GenDecl) Parent() Node

Parent return the parent node

func (*GenDecl) Parents

func (s *GenDecl) Parents() []Node

Parents returns the parent path of nodes

func (*GenDecl) Pkg

func (s *GenDecl) Pkg() *Package

Pkg returns the package this node belongs to.

func (*GenDecl) Siblings

func (s *GenDecl) Siblings() []Node

Siblings returns all sibling nodes

func (*GenDecl) Token

func (s *GenDecl) Token() token.Token

Token returns the token of the node

func (*GenDecl) TreeNode

func (s *GenDecl) TreeNode(cond func(n Node) bool) Node

TreeNode walks the child tree returning the first node that meets the condition

func (*GenDecl) TreeNodes

func (s *GenDecl) TreeNodes(cond func(n Node) bool) []Node

TreeNodes walks the child tree collecting all nodes that meet the condition

func (*GenDecl) ValueType

func (s *GenDecl) ValueType() types.Type

ValueType returns value type information of an expression, nil otherwise

func (*GenDecl) Visit

func (s *GenDecl) Visit(node ast.Node) ast.Visitor

Visit implements the ast.Visitor interface and is used to walk the underlying ast.Node tree

func (*GenDecl) Walk

func (s *GenDecl) Walk(f func(node Node) bool)

Walk traverses the tree and its children. return false to skip children of the current element

type GoStmt

type GoStmt struct {
	*ast.GoStmt
	// contains filtered or unexported fields
}

GoStmt wraps ast.GoStmt

func (*GoStmt) AstNode

func (s *GoStmt) AstNode() ast.Node

AstNode returns the original ast.Node

func (GoStmt) CallTreeNode

func (s GoStmt) CallTreeNode(cond func(n Node) bool) Node

CallTreeNode walks the call tree returning the first node that meets the condition

func (GoStmt) CallTreeNodes

func (s GoStmt) CallTreeNodes(cond func(n Node) bool) []Node

CallTreeNodes walks the call tree collecting all nodes that meet the condition

func (*GoStmt) ChildByName

func (s *GoStmt) ChildByName(name string) Node

ChildByName retrieves a node among the direkt children by name (only nodes that have a name)

func (*GoStmt) ChildByNodeType

func (s *GoStmt) ChildByNodeType(nodeType NodeType) Node

ChildByNodeType returns the first child of a certain type.

func (*GoStmt) ChildNode

func (s *GoStmt) ChildNode(cond func(n Node) bool) Node

ChildNode walks only child nodes returning the first node that meets the condition

func (*GoStmt) ChildNodes

func (s *GoStmt) ChildNodes(cond func(n Node) bool) []Node

ChildNodes walks only child nodes collecting all nodes that meet the condition

func (*GoStmt) Children

func (s *GoStmt) Children() []Node

Children returns all child nodes

func (*GoStmt) ChildrenByNodeType

func (s *GoStmt) ChildrenByNodeType(nodeType NodeType) []Node

ChildrenByNodeType returns the first child of a certain type.

func (*GoStmt) Contains

func (s *GoStmt) Contains(node Node) bool

Contains checks if a node contains another node

func (*GoStmt) FindByName

func (s *GoStmt) FindByName(name string) []Node

FindByName looks for a name in the entire sub tree

func (*GoStmt) FindByNodeType

func (s *GoStmt) FindByNodeType(nodeType NodeType) []Node

FindByNodeType returns all sub nodes of a certain type

func (*GoStmt) FindByToken

func (s *GoStmt) FindByToken(t token.Token) []Node

FindByToken finds a node with a token.Token attached and of given token type

func (*GoStmt) FindByValueType

func (s *GoStmt) FindByValueType(valType string) []Node

FindByValueType find all nodes with given value type

func (*GoStmt) FindDeclarations

func (s *GoStmt) FindDeclarations() []*Ident

FindDeclarations finds all declarations

func (*GoStmt) FindDeclarationsByType

func (s *GoStmt) FindDeclarationsByType(nodeType NodeType) []*Ident

FindDeclarationsByType finds all declarations by (parent) type

func (*GoStmt) FindFirstByName

func (s *GoStmt) FindFirstByName(name string) Node

FindFirstByName looks for a name in the entire sub tree. First node is returned if there are multiple.

func (*GoStmt) FindFirstByNodeType

func (s *GoStmt) FindFirstByNodeType(nodeType NodeType) Node

FindFirstByNodeType returns the first sub node of a certain type

func (*GoStmt) FindFirstIdentByName

func (s *GoStmt) FindFirstIdentByName(name string) *Ident

FindFirstIdentByName looks for the first Ident node in subtree with given name

func (*GoStmt) FindFirstUsage

func (s *GoStmt) FindFirstUsage(declaration *Ident) *Ident

FindFirstUsage selects the first usage

func (*GoStmt) FindIdentByName

func (s *GoStmt) FindIdentByName(name string) []*Ident

FindIdentByName looks for Ident nodes in the entire sub tree with given name

func (*GoStmt) FindMaps

func (s *GoStmt) FindMaps() []Node

FindMaps find all nodes with given value type

func (*GoStmt) FindNameInCallTree

func (s *GoStmt) FindNameInCallTree(name string) []Node

FindNameInCallTree returns all nodes in call tree with given name

func (*GoStmt) FindNodeTypeInCallTree

func (s *GoStmt) FindNodeTypeInCallTree(nodeType NodeType) []Node

FindNodeTypeInCallTree returns all nodes in call tree of a certain type

func (*GoStmt) FindUsages

func (s *GoStmt) FindUsages(declaration *Ident) []*Ident

FindUsages finds usages of given declaration

func (*GoStmt) FindVarDeclarations

func (s *GoStmt) FindVarDeclarations() []*Ident

FindVarDeclarations finds all assignStmt (:=), valueSpec (var, const) declarations

func (*GoStmt) GetScope

func (s *GoStmt) GetScope() (Node, *types.Scope)

GetScope returns the scope of the node

func (*GoStmt) GetSource

func (s *GoStmt) GetSource() []byte

GetSource returns the source code of the current node

func (*GoStmt) GetSourceString

func (s *GoStmt) GetSourceString() string

GetSourceString is a convenience function to GetSource as string

func (*GoStmt) Info

func (s *GoStmt) Info() *types.Info

Info returns the types.info node.

func (*GoStmt) IsContainedByType

func (s *GoStmt) IsContainedByType(nodeType NodeType) bool

IsContainedByType checks if node is contained by a node of given node type

func (*GoStmt) IsNodeType

func (s *GoStmt) IsNodeType(nodeType NodeType) bool

IsNodeType checks if node is of given node type

func (*GoStmt) IsValueType

func (s *GoStmt) IsValueType(valType string) bool

IsValueType checks if value type is of given type

func (*GoStmt) Level

func (s *GoStmt) Level() int

Level returns the level counted from instantiated node = 0

func (*GoStmt) Match

func (s *GoStmt) Match(regex regexp.Regexp) bool

Match matches the source code of current node and content with given regex

func (*GoStmt) NextParentByType

func (s *GoStmt) NextParentByType(nodeType NodeType) Node

NextParentByType returns the next parent of given type

func (*GoStmt) NodeType

func (s *GoStmt) NodeType() NodeType

NodeType returns the NodeType of the node

func (*GoStmt) Object

func (s *GoStmt) Object() types.Object

Object returns the object of an identifier, nil otherwise

func (*GoStmt) Parent

func (s *GoStmt) Parent() Node

Parent return the parent node

func (*GoStmt) Parents

func (s *GoStmt) Parents() []Node

Parents returns the parent path of nodes

func (*GoStmt) Pkg

func (s *GoStmt) Pkg() *Package

Pkg returns the package this node belongs to.

func (*GoStmt) Siblings

func (s *GoStmt) Siblings() []Node

Siblings returns all sibling nodes

func (*GoStmt) TreeNode

func (s *GoStmt) TreeNode(cond func(n Node) bool) Node

TreeNode walks the child tree returning the first node that meets the condition

func (*GoStmt) TreeNodes

func (s *GoStmt) TreeNodes(cond func(n Node) bool) []Node

TreeNodes walks the child tree collecting all nodes that meet the condition

func (*GoStmt) ValueType

func (s *GoStmt) ValueType() types.Type

ValueType returns value type information of an expression, nil otherwise

func (*GoStmt) Visit

func (s *GoStmt) Visit(node ast.Node) ast.Visitor

Visit implements the ast.Visitor interface and is used to walk the underlying ast.Node tree

func (*GoStmt) Walk

func (s *GoStmt) Walk(f func(node Node) bool)

Walk traverses the tree and its children. return false to skip children of the current element

type Ident

type Ident struct {
	*ast.Ident
	// contains filtered or unexported fields
}

Ident wraps ast.Ident

func (*Ident) AstNode

func (s *Ident) AstNode() ast.Node

AstNode returns the original ast.Node

func (Ident) CallTreeNode

func (s Ident) CallTreeNode(cond func(n Node) bool) Node

CallTreeNode walks the call tree returning the first node that meets the condition

func (Ident) CallTreeNodes

func (s Ident) CallTreeNodes(cond func(n Node) bool) []Node

CallTreeNodes walks the call tree collecting all nodes that meet the condition

func (*Ident) ChildByName

func (s *Ident) ChildByName(name string) Node

ChildByName retrieves a node among the direkt children by name (only nodes that have a name)

func (*Ident) ChildByNodeType

func (s *Ident) ChildByNodeType(nodeType NodeType) Node

ChildByNodeType returns the first child of a certain type.

func (*Ident) ChildNode

func (s *Ident) ChildNode(cond func(n Node) bool) Node

ChildNode walks only child nodes returning the first node that meets the condition

func (*Ident) ChildNodes

func (s *Ident) ChildNodes(cond func(n Node) bool) []Node

ChildNodes walks only child nodes collecting all nodes that meet the condition

func (*Ident) Children

func (s *Ident) Children() []Node

Children returns all child nodes

func (*Ident) ChildrenByNodeType

func (s *Ident) ChildrenByNodeType(nodeType NodeType) []Node

ChildrenByNodeType returns the first child of a certain type.

func (*Ident) Contains

func (s *Ident) Contains(node Node) bool

Contains checks if a node contains another node

func (*Ident) FindByName

func (s *Ident) FindByName(name string) []Node

FindByName looks for a name in the entire sub tree

func (*Ident) FindByNodeType

func (s *Ident) FindByNodeType(nodeType NodeType) []Node

FindByNodeType returns all sub nodes of a certain type

func (*Ident) FindByToken

func (s *Ident) FindByToken(t token.Token) []Node

FindByToken finds a node with a token.Token attached and of given token type

func (*Ident) FindByValueType

func (s *Ident) FindByValueType(valType string) []Node

FindByValueType find all nodes with given value type

func (*Ident) FindDeclarations

func (s *Ident) FindDeclarations() []*Ident

FindDeclarations finds all declarations

func (*Ident) FindDeclarationsByType

func (s *Ident) FindDeclarationsByType(nodeType NodeType) []*Ident

FindDeclarationsByType finds all declarations by (parent) type

func (*Ident) FindFirstByName

func (s *Ident) FindFirstByName(name string) Node

FindFirstByName looks for a name in the entire sub tree. First node is returned if there are multiple.

func (*Ident) FindFirstByNodeType

func (s *Ident) FindFirstByNodeType(nodeType NodeType) Node

FindFirstByNodeType returns the first sub node of a certain type

func (*Ident) FindFirstIdentByName

func (s *Ident) FindFirstIdentByName(name string) *Ident

FindFirstIdentByName looks for the first Ident node in subtree with given name

func (*Ident) FindFirstUsage

func (s *Ident) FindFirstUsage(declaration *Ident) *Ident

FindFirstUsage selects the first usage

func (*Ident) FindIdentByName

func (s *Ident) FindIdentByName(name string) []*Ident

FindIdentByName looks for Ident nodes in the entire sub tree with given name

func (*Ident) FindMaps

func (s *Ident) FindMaps() []Node

FindMaps find all nodes with given value type

func (*Ident) FindNameInCallTree

func (s *Ident) FindNameInCallTree(name string) []Node

FindNameInCallTree returns all nodes in call tree with given name

func (*Ident) FindNodeTypeInCallTree

func (s *Ident) FindNodeTypeInCallTree(nodeType NodeType) []Node

FindNodeTypeInCallTree returns all nodes in call tree of a certain type

func (*Ident) FindUsages

func (s *Ident) FindUsages(declaration *Ident) []*Ident

FindUsages finds usages of given declaration

func (*Ident) FindVarDeclarations

func (s *Ident) FindVarDeclarations() []*Ident

FindVarDeclarations finds all assignStmt (:=), valueSpec (var, const) declarations

func (*Ident) GetIdent

func (s *Ident) GetIdent() *Ident

GetIdent returns the name of the node

func (*Ident) GetScope

func (s *Ident) GetScope() (Node, *types.Scope)

GetScope returns the scope of the node

func (*Ident) GetSource

func (s *Ident) GetSource() []byte

GetSource returns the source code of the current node

func (*Ident) GetSourceString

func (s *Ident) GetSourceString() string

GetSourceString is a convenience function to GetSource as string

func (*Ident) Info

func (s *Ident) Info() *types.Info

Info returns the types.info node.

func (*Ident) IsContainedByType

func (s *Ident) IsContainedByType(nodeType NodeType) bool

IsContainedByType checks if node is contained by a node of given node type

func (*Ident) IsNodeType

func (s *Ident) IsNodeType(nodeType NodeType) bool

IsNodeType checks if node is of given node type

func (*Ident) IsValueType

func (s *Ident) IsValueType(valType string) bool

IsValueType checks if value type is of given type

func (*Ident) Level

func (s *Ident) Level() int

Level returns the level counted from instantiated node = 0

func (*Ident) Match

func (s *Ident) Match(regex regexp.Regexp) bool

Match matches the source code of current node and content with given regex

func (*Ident) NextParentByType

func (s *Ident) NextParentByType(nodeType NodeType) Node

NextParentByType returns the next parent of given type

func (*Ident) NodeName

func (s *Ident) NodeName() string

NodeName returns the name of the node

func (*Ident) NodeType

func (s *Ident) NodeType() NodeType

NodeType returns the NodeType of the node

func (*Ident) Object

func (s *Ident) Object() types.Object

Object returns the object of an identifier, nil otherwise

func (*Ident) Parent

func (s *Ident) Parent() Node

Parent return the parent node

func (*Ident) Parents

func (s *Ident) Parents() []Node

Parents returns the parent path of nodes

func (*Ident) Pkg

func (s *Ident) Pkg() *Package

Pkg returns the package this node belongs to.

func (*Ident) Siblings

func (s *Ident) Siblings() []Node

Siblings returns all sibling nodes

func (*Ident) TreeNode

func (s *Ident) TreeNode(cond func(n Node) bool) Node

TreeNode walks the child tree returning the first node that meets the condition

func (*Ident) TreeNodes

func (s *Ident) TreeNodes(cond func(n Node) bool) []Node

TreeNodes walks the child tree collecting all nodes that meet the condition

func (*Ident) ValueType

func (s *Ident) ValueType() types.Type

ValueType returns the value type of the node.

func (*Ident) Visit

func (s *Ident) Visit(node ast.Node) ast.Visitor

Visit implements the ast.Visitor interface and is used to walk the underlying ast.Node tree

func (*Ident) Walk

func (s *Ident) Walk(f func(node Node) bool)

Walk traverses the tree and its children. return false to skip children of the current element

type Identifier

type Identifier interface {
	GetIdent() *Ident
}

Identifier defines a node element with an ident attached to it or ident itself

type IfStmt

type IfStmt struct {
	*ast.IfStmt
	// contains filtered or unexported fields
}

IfStmt wraps ast.IfStmt

func (*IfStmt) AstNode

func (s *IfStmt) AstNode() ast.Node

AstNode returns the original ast.Node

func (IfStmt) CallTreeNode

func (s IfStmt) CallTreeNode(cond func(n Node) bool) Node

CallTreeNode walks the call tree returning the first node that meets the condition

func (IfStmt) CallTreeNodes

func (s IfStmt) CallTreeNodes(cond func(n Node) bool) []Node

CallTreeNodes walks the call tree collecting all nodes that meet the condition

func (*IfStmt) ChildByName

func (s *IfStmt) ChildByName(name string) Node

ChildByName retrieves a node among the direkt children by name (only nodes that have a name)

func (*IfStmt) ChildByNodeType

func (s *IfStmt) ChildByNodeType(nodeType NodeType) Node

ChildByNodeType returns the first child of a certain type.

func (*IfStmt) ChildNode

func (s *IfStmt) ChildNode(cond func(n Node) bool) Node

ChildNode walks only child nodes returning the first node that meets the condition

func (*IfStmt) ChildNodes

func (s *IfStmt) ChildNodes(cond func(n Node) bool) []Node

ChildNodes walks only child nodes collecting all nodes that meet the condition

func (*IfStmt) Children

func (s *IfStmt) Children() []Node

Children returns all child nodes

func (*IfStmt) ChildrenByNodeType

func (s *IfStmt) ChildrenByNodeType(nodeType NodeType) []Node

ChildrenByNodeType returns the first child of a certain type.

func (*IfStmt) Contains

func (s *IfStmt) Contains(node Node) bool

Contains checks if a node contains another node

func (*IfStmt) FindByName

func (s *IfStmt) FindByName(name string) []Node

FindByName looks for a name in the entire sub tree

func (*IfStmt) FindByNodeType

func (s *IfStmt) FindByNodeType(nodeType NodeType) []Node

FindByNodeType returns all sub nodes of a certain type

func (*IfStmt) FindByToken

func (s *IfStmt) FindByToken(t token.Token) []Node

FindByToken finds a node with a token.Token attached and of given token type

func (*IfStmt) FindByValueType

func (s *IfStmt) FindByValueType(valType string) []Node

FindByValueType find all nodes with given value type

func (*IfStmt) FindDeclarations

func (s *IfStmt) FindDeclarations() []*Ident

FindDeclarations finds all declarations

func (*IfStmt) FindDeclarationsByType

func (s *IfStmt) FindDeclarationsByType(nodeType NodeType) []*Ident

FindDeclarationsByType finds all declarations by (parent) type

func (*IfStmt) FindFirstByName

func (s *IfStmt) FindFirstByName(name string) Node

FindFirstByName looks for a name in the entire sub tree. First node is returned if there are multiple.

func (*IfStmt) FindFirstByNodeType

func (s *IfStmt) FindFirstByNodeType(nodeType NodeType) Node

FindFirstByNodeType returns the first sub node of a certain type

func (*IfStmt) FindFirstIdentByName

func (s *IfStmt) FindFirstIdentByName(name string) *Ident

FindFirstIdentByName looks for the first Ident node in subtree with given name

func (*IfStmt) FindFirstUsage

func (s *IfStmt) FindFirstUsage(declaration *Ident) *Ident

FindFirstUsage selects the first usage

func (*IfStmt) FindIdentByName

func (s *IfStmt) FindIdentByName(name string) []*Ident

FindIdentByName looks for Ident nodes in the entire sub tree with given name

func (*IfStmt) FindMaps

func (s *IfStmt) FindMaps() []Node

FindMaps find all nodes with given value type

func (*IfStmt) FindNameInCallTree

func (s *IfStmt) FindNameInCallTree(name string) []Node

FindNameInCallTree returns all nodes in call tree with given name

func (*IfStmt) FindNodeTypeInCallTree

func (s *IfStmt) FindNodeTypeInCallTree(nodeType NodeType) []Node

FindNodeTypeInCallTree returns all nodes in call tree of a certain type

func (*IfStmt) FindUsages

func (s *IfStmt) FindUsages(declaration *Ident) []*Ident

FindUsages finds usages of given declaration

func (*IfStmt) FindVarDeclarations

func (s *IfStmt) FindVarDeclarations() []*Ident

FindVarDeclarations finds all assignStmt (:=), valueSpec (var, const) declarations

func (*IfStmt) GetScope

func (s *IfStmt) GetScope() (Node, *types.Scope)

GetScope returns the scope of the node

func (*IfStmt) GetSource

func (s *IfStmt) GetSource() []byte

GetSource returns the source code of the current node

func (*IfStmt) GetSourceString

func (s *IfStmt) GetSourceString() string

GetSourceString is a convenience function to GetSource as string

func (*IfStmt) Info

func (s *IfStmt) Info() *types.Info

Info returns the types.info node.

func (*IfStmt) IsContainedByType

func (s *IfStmt) IsContainedByType(nodeType NodeType) bool

IsContainedByType checks if node is contained by a node of given node type

func (*IfStmt) IsNodeType

func (s *IfStmt) IsNodeType(nodeType NodeType) bool

IsNodeType checks if node is of given node type

func (*IfStmt) IsValueType

func (s *IfStmt) IsValueType(valType string) bool

IsValueType checks if value type is of given type

func (*IfStmt) Level

func (s *IfStmt) Level() int

Level returns the level counted from instantiated node = 0

func (*IfStmt) Match

func (s *IfStmt) Match(regex regexp.Regexp) bool

Match matches the source code of current node and content with given regex

func (*IfStmt) NextParentByType

func (s *IfStmt) NextParentByType(nodeType NodeType) Node

NextParentByType returns the next parent of given type

func (*IfStmt) NodeType

func (s *IfStmt) NodeType() NodeType

NodeType returns the NodeType of the node

func (*IfStmt) Object

func (s *IfStmt) Object() types.Object

Object returns the object of an identifier, nil otherwise

func (*IfStmt) Parent

func (s *IfStmt) Parent() Node

Parent return the parent node

func (*IfStmt) Parents

func (s *IfStmt) Parents() []Node

Parents returns the parent path of nodes

func (*IfStmt) Pkg

func (s *IfStmt) Pkg() *Package

Pkg returns the package this node belongs to.

func (*IfStmt) Siblings

func (s *IfStmt) Siblings() []Node

Siblings returns all sibling nodes

func (*IfStmt) TreeNode

func (s *IfStmt) TreeNode(cond func(n Node) bool) Node

TreeNode walks the child tree returning the first node that meets the condition

func (*IfStmt) TreeNodes

func (s *IfStmt) TreeNodes(cond func(n Node) bool) []Node

TreeNodes walks the child tree collecting all nodes that meet the condition

func (*IfStmt) ValueType

func (s *IfStmt) ValueType() types.Type

ValueType returns value type information of an expression, nil otherwise

func (*IfStmt) Visit

func (s *IfStmt) Visit(node ast.Node) ast.Visitor

Visit implements the ast.Visitor interface and is used to walk the underlying ast.Node tree

func (*IfStmt) Walk

func (s *IfStmt) Walk(f func(node Node) bool)

Walk traverses the tree and its children. return false to skip children of the current element

type ImportSpec

type ImportSpec struct {
	*ast.ImportSpec
	// contains filtered or unexported fields
}

ImportSpec wraps ast.ImportSpec

func (*ImportSpec) AstNode

func (s *ImportSpec) AstNode() ast.Node

AstNode returns the original ast.Node

func (ImportSpec) CallTreeNode

func (s ImportSpec) CallTreeNode(cond func(n Node) bool) Node

CallTreeNode walks the call tree returning the first node that meets the condition

func (ImportSpec) CallTreeNodes

func (s ImportSpec) CallTreeNodes(cond func(n Node) bool) []Node

CallTreeNodes walks the call tree collecting all nodes that meet the condition

func (*ImportSpec) ChildByName

func (s *ImportSpec) ChildByName(name string) Node

ChildByName retrieves a node among the direkt children by name (only nodes that have a name)

func (*ImportSpec) ChildByNodeType

func (s *ImportSpec) ChildByNodeType(nodeType NodeType) Node

ChildByNodeType returns the first child of a certain type.

func (*ImportSpec) ChildNode

func (s *ImportSpec) ChildNode(cond func(n Node) bool) Node

ChildNode walks only child nodes returning the first node that meets the condition

func (*ImportSpec) ChildNodes

func (s *ImportSpec) ChildNodes(cond func(n Node) bool) []Node

ChildNodes walks only child nodes collecting all nodes that meet the condition

func (*ImportSpec) Children

func (s *ImportSpec) Children() []Node

Children returns all child nodes

func (*ImportSpec) ChildrenByNodeType

func (s *ImportSpec) ChildrenByNodeType(nodeType NodeType) []Node

ChildrenByNodeType returns the first child of a certain type.

func (*ImportSpec) Contains

func (s *ImportSpec) Contains(node Node) bool

Contains checks if a node contains another node

func (*ImportSpec) FindByName

func (s *ImportSpec) FindByName(name string) []Node

FindByName looks for a name in the entire sub tree

func (*ImportSpec) FindByNodeType

func (s *ImportSpec) FindByNodeType(nodeType NodeType) []Node

FindByNodeType returns all sub nodes of a certain type

func (*ImportSpec) FindByToken

func (s *ImportSpec) FindByToken(t token.Token) []Node

FindByToken finds a node with a token.Token attached and of given token type

func (*ImportSpec) FindByValueType

func (s *ImportSpec) FindByValueType(valType string) []Node

FindByValueType find all nodes with given value type

func (*ImportSpec) FindDeclarations

func (s *ImportSpec) FindDeclarations() []*Ident

FindDeclarations finds all declarations

func (*ImportSpec) FindDeclarationsByType

func (s *ImportSpec) FindDeclarationsByType(nodeType NodeType) []*Ident

FindDeclarationsByType finds all declarations by (parent) type

func (*ImportSpec) FindFirstByName

func (s *ImportSpec) FindFirstByName(name string) Node

FindFirstByName looks for a name in the entire sub tree. First node is returned if there are multiple.

func (*ImportSpec) FindFirstByNodeType

func (s *ImportSpec) FindFirstByNodeType(nodeType NodeType) Node

FindFirstByNodeType returns the first sub node of a certain type

func (*ImportSpec) FindFirstIdentByName

func (s *ImportSpec) FindFirstIdentByName(name string) *Ident

FindFirstIdentByName looks for the first Ident node in subtree with given name

func (*ImportSpec) FindFirstUsage

func (s *ImportSpec) FindFirstUsage(declaration *Ident) *Ident

FindFirstUsage selects the first usage

func (*ImportSpec) FindIdentByName

func (s *ImportSpec) FindIdentByName(name string) []*Ident

FindIdentByName looks for Ident nodes in the entire sub tree with given name

func (*ImportSpec) FindMaps

func (s *ImportSpec) FindMaps() []Node

FindMaps find all nodes with given value type

func (*ImportSpec) FindNameInCallTree

func (s *ImportSpec) FindNameInCallTree(name string) []Node

FindNameInCallTree returns all nodes in call tree with given name

func (*ImportSpec) FindNodeTypeInCallTree

func (s *ImportSpec) FindNodeTypeInCallTree(nodeType NodeType) []Node

FindNodeTypeInCallTree returns all nodes in call tree of a certain type

func (*ImportSpec) FindUsages

func (s *ImportSpec) FindUsages(declaration *Ident) []*Ident

FindUsages finds usages of given declaration

func (*ImportSpec) FindVarDeclarations

func (s *ImportSpec) FindVarDeclarations() []*Ident

FindVarDeclarations finds all assignStmt (:=), valueSpec (var, const) declarations

func (*ImportSpec) GetIdent

func (s *ImportSpec) GetIdent() *Ident

GetIdent returns the name of the node

func (*ImportSpec) GetScope

func (s *ImportSpec) GetScope() (Node, *types.Scope)

GetScope returns the scope of the node

func (*ImportSpec) GetSource

func (s *ImportSpec) GetSource() []byte

GetSource returns the source code of the current node

func (*ImportSpec) GetSourceString

func (s *ImportSpec) GetSourceString() string

GetSourceString is a convenience function to GetSource as string

func (*ImportSpec) Info

func (s *ImportSpec) Info() *types.Info

Info returns the types.info node.

func (*ImportSpec) IsContainedByType

func (s *ImportSpec) IsContainedByType(nodeType NodeType) bool

IsContainedByType checks if node is contained by a node of given node type

func (*ImportSpec) IsNodeType

func (s *ImportSpec) IsNodeType(nodeType NodeType) bool

IsNodeType checks if node is of given node type

func (*ImportSpec) IsValueType

func (s *ImportSpec) IsValueType(valType string) bool

IsValueType checks if value type is of given type

func (*ImportSpec) Level

func (s *ImportSpec) Level() int

Level returns the level counted from instantiated node = 0

func (*ImportSpec) Match

func (s *ImportSpec) Match(regex regexp.Regexp) bool

Match matches the source code of current node and content with given regex

func (*ImportSpec) NextParentByType

func (s *ImportSpec) NextParentByType(nodeType NodeType) Node

NextParentByType returns the next parent of given type

func (*ImportSpec) NodeName

func (s *ImportSpec) NodeName() string

NodeName returns the name of the node

func (*ImportSpec) NodeType

func (s *ImportSpec) NodeType() NodeType

NodeType returns the NodeType of the node

func (*ImportSpec) Object

func (s *ImportSpec) Object() types.Object

Object returns the object of an identifier, nil otherwise

func (*ImportSpec) Parent

func (s *ImportSpec) Parent() Node

Parent return the parent node

func (*ImportSpec) Parents

func (s *ImportSpec) Parents() []Node

Parents returns the parent path of nodes

func (*ImportSpec) Pkg

func (s *ImportSpec) Pkg() *Package

Pkg returns the package this node belongs to.

func (*ImportSpec) Siblings

func (s *ImportSpec) Siblings() []Node

Siblings returns all sibling nodes

func (*ImportSpec) TreeNode

func (s *ImportSpec) TreeNode(cond func(n Node) bool) Node

TreeNode walks the child tree returning the first node that meets the condition

func (*ImportSpec) TreeNodes

func (s *ImportSpec) TreeNodes(cond func(n Node) bool) []Node

TreeNodes walks the child tree collecting all nodes that meet the condition

func (*ImportSpec) ValueType

func (s *ImportSpec) ValueType() types.Type

ValueType returns value type information of an expression, nil otherwise

func (*ImportSpec) Visit

func (s *ImportSpec) Visit(node ast.Node) ast.Visitor

Visit implements the ast.Visitor interface and is used to walk the underlying ast.Node tree

func (*ImportSpec) Walk

func (s *ImportSpec) Walk(f func(node Node) bool)

Walk traverses the tree and its children. return false to skip children of the current element

type IncDecStmt

type IncDecStmt struct {
	*ast.IncDecStmt
	// contains filtered or unexported fields
}

IncDecStmt wraps ast.IncDecStmt

func (*IncDecStmt) AstNode

func (s *IncDecStmt) AstNode() ast.Node

AstNode returns the original ast.Node

func (IncDecStmt) CallTreeNode

func (s IncDecStmt) CallTreeNode(cond func(n Node) bool) Node

CallTreeNode walks the call tree returning the first node that meets the condition

func (IncDecStmt) CallTreeNodes

func (s IncDecStmt) CallTreeNodes(cond func(n Node) bool) []Node

CallTreeNodes walks the call tree collecting all nodes that meet the condition

func (*IncDecStmt) ChildByName

func (s *IncDecStmt) ChildByName(name string) Node

ChildByName retrieves a node among the direkt children by name (only nodes that have a name)

func (*IncDecStmt) ChildByNodeType

func (s *IncDecStmt) ChildByNodeType(nodeType NodeType) Node

ChildByNodeType returns the first child of a certain type.

func (*IncDecStmt) ChildNode

func (s *IncDecStmt) ChildNode(cond func(n Node) bool) Node

ChildNode walks only child nodes returning the first node that meets the condition

func (*IncDecStmt) ChildNodes

func (s *IncDecStmt) ChildNodes(cond func(n Node) bool) []Node

ChildNodes walks only child nodes collecting all nodes that meet the condition

func (*IncDecStmt) Children

func (s *IncDecStmt) Children() []Node

Children returns all child nodes

func (*IncDecStmt) ChildrenByNodeType

func (s *IncDecStmt) ChildrenByNodeType(nodeType NodeType) []Node

ChildrenByNodeType returns the first child of a certain type.

func (*IncDecStmt) Contains

func (s *IncDecStmt) Contains(node Node) bool

Contains checks if a node contains another node

func (*IncDecStmt) FindByName

func (s *IncDecStmt) FindByName(name string) []Node

FindByName looks for a name in the entire sub tree

func (*IncDecStmt) FindByNodeType

func (s *IncDecStmt) FindByNodeType(nodeType NodeType) []Node

FindByNodeType returns all sub nodes of a certain type

func (*IncDecStmt) FindByToken

func (s *IncDecStmt) FindByToken(t token.Token) []Node

FindByToken finds a node with a token.Token attached and of given token type

func (*IncDecStmt) FindByValueType

func (s *IncDecStmt) FindByValueType(valType string) []Node

FindByValueType find all nodes with given value type

func (*IncDecStmt) FindDeclarations

func (s *IncDecStmt) FindDeclarations() []*Ident

FindDeclarations finds all declarations

func (*IncDecStmt) FindDeclarationsByType

func (s *IncDecStmt) FindDeclarationsByType(nodeType NodeType) []*Ident

FindDeclarationsByType finds all declarations by (parent) type

func (*IncDecStmt) FindFirstByName

func (s *IncDecStmt) FindFirstByName(name string) Node

FindFirstByName looks for a name in the entire sub tree. First node is returned if there are multiple.

func (*IncDecStmt) FindFirstByNodeType

func (s *IncDecStmt) FindFirstByNodeType(nodeType NodeType) Node

FindFirstByNodeType returns the first sub node of a certain type

func (*IncDecStmt) FindFirstIdentByName

func (s *IncDecStmt) FindFirstIdentByName(name string) *Ident

FindFirstIdentByName looks for the first Ident node in subtree with given name

func (*IncDecStmt) FindFirstUsage

func (s *IncDecStmt) FindFirstUsage(declaration *Ident) *Ident

FindFirstUsage selects the first usage

func (*IncDecStmt) FindIdentByName

func (s *IncDecStmt) FindIdentByName(name string) []*Ident

FindIdentByName looks for Ident nodes in the entire sub tree with given name

func (*IncDecStmt) FindMaps

func (s *IncDecStmt) FindMaps() []Node

FindMaps find all nodes with given value type

func (*IncDecStmt) FindNameInCallTree

func (s *IncDecStmt) FindNameInCallTree(name string) []Node

FindNameInCallTree returns all nodes in call tree with given name

func (*IncDecStmt) FindNodeTypeInCallTree

func (s *IncDecStmt) FindNodeTypeInCallTree(nodeType NodeType) []Node

FindNodeTypeInCallTree returns all nodes in call tree of a certain type

func (*IncDecStmt) FindUsages

func (s *IncDecStmt) FindUsages(declaration *Ident) []*Ident

FindUsages finds usages of given declaration

func (*IncDecStmt) FindVarDeclarations

func (s *IncDecStmt) FindVarDeclarations() []*Ident

FindVarDeclarations finds all assignStmt (:=), valueSpec (var, const) declarations

func (*IncDecStmt) GetScope

func (s *IncDecStmt) GetScope() (Node, *types.Scope)

GetScope returns the scope of the node

func (*IncDecStmt) GetSource

func (s *IncDecStmt) GetSource() []byte

GetSource returns the source code of the current node

func (*IncDecStmt) GetSourceString

func (s *IncDecStmt) GetSourceString() string

GetSourceString is a convenience function to GetSource as string

func (*IncDecStmt) Info

func (s *IncDecStmt) Info() *types.Info

Info returns the types.info node.

func (*IncDecStmt) IsContainedByType

func (s *IncDecStmt) IsContainedByType(nodeType NodeType) bool

IsContainedByType checks if node is contained by a node of given node type

func (*IncDecStmt) IsNodeType

func (s *IncDecStmt) IsNodeType(nodeType NodeType) bool

IsNodeType checks if node is of given node type

func (*IncDecStmt) IsValueType

func (s *IncDecStmt) IsValueType(valType string) bool

IsValueType checks if value type is of given type

func (*IncDecStmt) Level

func (s *IncDecStmt) Level() int

Level returns the level counted from instantiated node = 0

func (*IncDecStmt) Match

func (s *IncDecStmt) Match(regex regexp.Regexp) bool

Match matches the source code of current node and content with given regex

func (*IncDecStmt) NextParentByType

func (s *IncDecStmt) NextParentByType(nodeType NodeType) Node

NextParentByType returns the next parent of given type

func (*IncDecStmt) NodeType

func (s *IncDecStmt) NodeType() NodeType

NodeType returns the NodeType of the node

func (*IncDecStmt) Object

func (s *IncDecStmt) Object() types.Object

Object returns the object of an identifier, nil otherwise

func (*IncDecStmt) Parent

func (s *IncDecStmt) Parent() Node

Parent return the parent node

func (*IncDecStmt) Parents

func (s *IncDecStmt) Parents() []Node

Parents returns the parent path of nodes

func (*IncDecStmt) Pkg

func (s *IncDecStmt) Pkg() *Package

Pkg returns the package this node belongs to.

func (*IncDecStmt) Siblings

func (s *IncDecStmt) Siblings() []Node

Siblings returns all sibling nodes

func (*IncDecStmt) Token

func (s *IncDecStmt) Token() token.Token

Token returns the token of the node

func (*IncDecStmt) TreeNode

func (s *IncDecStmt) TreeNode(cond func(n Node) bool) Node

TreeNode walks the child tree returning the first node that meets the condition

func (*IncDecStmt) TreeNodes

func (s *IncDecStmt) TreeNodes(cond func(n Node) bool) []Node

TreeNodes walks the child tree collecting all nodes that meet the condition

func (*IncDecStmt) ValueType

func (s *IncDecStmt) ValueType() types.Type

ValueType returns value type information of an expression, nil otherwise

func (*IncDecStmt) Visit

func (s *IncDecStmt) Visit(node ast.Node) ast.Visitor

Visit implements the ast.Visitor interface and is used to walk the underlying ast.Node tree

func (*IncDecStmt) Walk

func (s *IncDecStmt) Walk(f func(node Node) bool)

Walk traverses the tree and its children. return false to skip children of the current element

type IndexExpr

type IndexExpr struct {
	*ast.IndexExpr
	// contains filtered or unexported fields
}

IndexExpr wraps ast.IndexExpr

func (*IndexExpr) AstNode

func (s *IndexExpr) AstNode() ast.Node

AstNode returns the original ast.Node

func (IndexExpr) CallTreeNode

func (s IndexExpr) CallTreeNode(cond func(n Node) bool) Node

CallTreeNode walks the call tree returning the first node that meets the condition

func (IndexExpr) CallTreeNodes

func (s IndexExpr) CallTreeNodes(cond func(n Node) bool) []Node

CallTreeNodes walks the call tree collecting all nodes that meet the condition

func (*IndexExpr) ChildByName

func (s *IndexExpr) ChildByName(name string) Node

ChildByName retrieves a node among the direkt children by name (only nodes that have a name)

func (*IndexExpr) ChildByNodeType

func (s *IndexExpr) ChildByNodeType(nodeType NodeType) Node

ChildByNodeType returns the first child of a certain type.

func (*IndexExpr) ChildNode

func (s *IndexExpr) ChildNode(cond func(n Node) bool) Node

ChildNode walks only child nodes returning the first node that meets the condition

func (*IndexExpr) ChildNodes

func (s *IndexExpr) ChildNodes(cond func(n Node) bool) []Node

ChildNodes walks only child nodes collecting all nodes that meet the condition

func (*IndexExpr) Children

func (s *IndexExpr) Children() []Node

Children returns all child nodes

func (*IndexExpr) ChildrenByNodeType

func (s *IndexExpr) ChildrenByNodeType(nodeType NodeType) []Node

ChildrenByNodeType returns the first child of a certain type.

func (*IndexExpr) Contains

func (s *IndexExpr) Contains(node Node) bool

Contains checks if a node contains another node

func (*IndexExpr) FindByName

func (s *IndexExpr) FindByName(name string) []Node

FindByName looks for a name in the entire sub tree

func (*IndexExpr) FindByNodeType

func (s *IndexExpr) FindByNodeType(nodeType NodeType) []Node

FindByNodeType returns all sub nodes of a certain type

func (*IndexExpr) FindByToken

func (s *IndexExpr) FindByToken(t token.Token) []Node

FindByToken finds a node with a token.Token attached and of given token type

func (*IndexExpr) FindByValueType

func (s *IndexExpr) FindByValueType(valType string) []Node

FindByValueType find all nodes with given value type

func (*IndexExpr) FindDeclarations

func (s *IndexExpr) FindDeclarations() []*Ident

FindDeclarations finds all declarations

func (*IndexExpr) FindDeclarationsByType

func (s *IndexExpr) FindDeclarationsByType(nodeType NodeType) []*Ident

FindDeclarationsByType finds all declarations by (parent) type

func (*IndexExpr) FindFirstByName

func (s *IndexExpr) FindFirstByName(name string) Node

FindFirstByName looks for a name in the entire sub tree. First node is returned if there are multiple.

func (*IndexExpr) FindFirstByNodeType

func (s *IndexExpr) FindFirstByNodeType(nodeType NodeType) Node

FindFirstByNodeType returns the first sub node of a certain type

func (*IndexExpr) FindFirstIdentByName

func (s *IndexExpr) FindFirstIdentByName(name string) *Ident

FindFirstIdentByName looks for the first Ident node in subtree with given name

func (*IndexExpr) FindFirstUsage

func (s *IndexExpr) FindFirstUsage(declaration *Ident) *Ident

FindFirstUsage selects the first usage

func (*IndexExpr) FindIdentByName

func (s *IndexExpr) FindIdentByName(name string) []*Ident

FindIdentByName looks for Ident nodes in the entire sub tree with given name

func (*IndexExpr) FindMaps

func (s *IndexExpr) FindMaps() []Node

FindMaps find all nodes with given value type

func (*IndexExpr) FindNameInCallTree

func (s *IndexExpr) FindNameInCallTree(name string) []Node

FindNameInCallTree returns all nodes in call tree with given name

func (*IndexExpr) FindNodeTypeInCallTree

func (s *IndexExpr) FindNodeTypeInCallTree(nodeType NodeType) []Node

FindNodeTypeInCallTree returns all nodes in call tree of a certain type

func (*IndexExpr) FindUsages

func (s *IndexExpr) FindUsages(declaration *Ident) []*Ident

FindUsages finds usages of given declaration

func (*IndexExpr) FindVarDeclarations

func (s *IndexExpr) FindVarDeclarations() []*Ident

FindVarDeclarations finds all assignStmt (:=), valueSpec (var, const) declarations

func (*IndexExpr) GetScope

func (s *IndexExpr) GetScope() (Node, *types.Scope)

GetScope returns the scope of the node

func (*IndexExpr) GetSource

func (s *IndexExpr) GetSource() []byte

GetSource returns the source code of the current node

func (*IndexExpr) GetSourceString

func (s *IndexExpr) GetSourceString() string

GetSourceString is a convenience function to GetSource as string

func (*IndexExpr) Info

func (s *IndexExpr) Info() *types.Info

Info returns the types.info node.

func (*IndexExpr) IsContainedByType

func (s *IndexExpr) IsContainedByType(nodeType NodeType) bool

IsContainedByType checks if node is contained by a node of given node type

func (*IndexExpr) IsNodeType

func (s *IndexExpr) IsNodeType(nodeType NodeType) bool

IsNodeType checks if node is of given node type

func (*IndexExpr) IsValueType

func (s *IndexExpr) IsValueType(valType string) bool

IsValueType checks if value type is of given type

func (*IndexExpr) Level

func (s *IndexExpr) Level() int

Level returns the level counted from instantiated node = 0

func (*IndexExpr) Match

func (s *IndexExpr) Match(regex regexp.Regexp) bool

Match matches the source code of current node and content with given regex

func (*IndexExpr) NextParentByType

func (s *IndexExpr) NextParentByType(nodeType NodeType) Node

NextParentByType returns the next parent of given type

func (*IndexExpr) NodeType

func (s *IndexExpr) NodeType() NodeType

NodeType returns the NodeType of the node

func (*IndexExpr) Object

func (s *IndexExpr) Object() types.Object

Object returns the object of an identifier, nil otherwise

func (*IndexExpr) Parent

func (s *IndexExpr) Parent() Node

Parent return the parent node

func (*IndexExpr) Parents

func (s *IndexExpr) Parents() []Node

Parents returns the parent path of nodes

func (*IndexExpr) Pkg

func (s *IndexExpr) Pkg() *Package

Pkg returns the package this node belongs to.

func (*IndexExpr) Siblings

func (s *IndexExpr) Siblings() []Node

Siblings returns all sibling nodes

func (*IndexExpr) TreeNode

func (s *IndexExpr) TreeNode(cond func(n Node) bool) Node

TreeNode walks the child tree returning the first node that meets the condition

func (*IndexExpr) TreeNodes

func (s *IndexExpr) TreeNodes(cond func(n Node) bool) []Node

TreeNodes walks the child tree collecting all nodes that meet the condition

func (*IndexExpr) ValueType

func (s *IndexExpr) ValueType() types.Type

ValueType returns value type information of an expression, nil otherwise

func (*IndexExpr) Visit

func (s *IndexExpr) Visit(node ast.Node) ast.Visitor

Visit implements the ast.Visitor interface and is used to walk the underlying ast.Node tree

func (*IndexExpr) Walk

func (s *IndexExpr) Walk(f func(node Node) bool)

Walk traverses the tree and its children. return false to skip children of the current element

type InterfaceType

type InterfaceType struct {
	*ast.InterfaceType
	// contains filtered or unexported fields
}

InterfaceType wraps ast.InterfaceType

func (*InterfaceType) AstNode

func (s *InterfaceType) AstNode() ast.Node

AstNode returns the original ast.Node

func (InterfaceType) CallTreeNode

func (s InterfaceType) CallTreeNode(cond func(n Node) bool) Node

CallTreeNode walks the call tree returning the first node that meets the condition

func (InterfaceType) CallTreeNodes

func (s InterfaceType) CallTreeNodes(cond func(n Node) bool) []Node

CallTreeNodes walks the call tree collecting all nodes that meet the condition

func (*InterfaceType) ChildByName

func (s *InterfaceType) ChildByName(name string) Node

ChildByName retrieves a node among the direkt children by name (only nodes that have a name)

func (*InterfaceType) ChildByNodeType

func (s *InterfaceType) ChildByNodeType(nodeType NodeType) Node

ChildByNodeType returns the first child of a certain type.

func (*InterfaceType) ChildNode

func (s *InterfaceType) ChildNode(cond func(n Node) bool) Node

ChildNode walks only child nodes returning the first node that meets the condition

func (*InterfaceType) ChildNodes

func (s *InterfaceType) ChildNodes(cond func(n Node) bool) []Node

ChildNodes walks only child nodes collecting all nodes that meet the condition

func (*InterfaceType) Children

func (s *InterfaceType) Children() []Node

Children returns all child nodes

func (*InterfaceType) ChildrenByNodeType

func (s *InterfaceType) ChildrenByNodeType(nodeType NodeType) []Node

ChildrenByNodeType returns the first child of a certain type.

func (*InterfaceType) Contains

func (s *InterfaceType) Contains(node Node) bool

Contains checks if a node contains another node

func (*InterfaceType) FindByName

func (s *InterfaceType) FindByName(name string) []Node

FindByName looks for a name in the entire sub tree

func (*InterfaceType) FindByNodeType

func (s *InterfaceType) FindByNodeType(nodeType NodeType) []Node

FindByNodeType returns all sub nodes of a certain type

func (*InterfaceType) FindByToken

func (s *InterfaceType) FindByToken(t token.Token) []Node

FindByToken finds a node with a token.Token attached and of given token type

func (*InterfaceType) FindByValueType

func (s *InterfaceType) FindByValueType(valType string) []Node

FindByValueType find all nodes with given value type

func (*InterfaceType) FindDeclarations

func (s *InterfaceType) FindDeclarations() []*Ident

FindDeclarations finds all declarations

func (*InterfaceType) FindDeclarationsByType

func (s *InterfaceType) FindDeclarationsByType(nodeType NodeType) []*Ident

FindDeclarationsByType finds all declarations by (parent) type

func (*InterfaceType) FindFirstByName

func (s *InterfaceType) FindFirstByName(name string) Node

FindFirstByName looks for a name in the entire sub tree. First node is returned if there are multiple.

func (*InterfaceType) FindFirstByNodeType

func (s *InterfaceType) FindFirstByNodeType(nodeType NodeType) Node

FindFirstByNodeType returns the first sub node of a certain type

func (*InterfaceType) FindFirstIdentByName

func (s *InterfaceType) FindFirstIdentByName(name string) *Ident

FindFirstIdentByName looks for the first Ident node in subtree with given name

func (*InterfaceType) FindFirstUsage

func (s *InterfaceType) FindFirstUsage(declaration *Ident) *Ident

FindFirstUsage selects the first usage

func (*InterfaceType) FindIdentByName

func (s *InterfaceType) FindIdentByName(name string) []*Ident

FindIdentByName looks for Ident nodes in the entire sub tree with given name

func (*InterfaceType) FindMaps

func (s *InterfaceType) FindMaps() []Node

FindMaps find all nodes with given value type

func (*InterfaceType) FindNameInCallTree

func (s *InterfaceType) FindNameInCallTree(name string) []Node

FindNameInCallTree returns all nodes in call tree with given name

func (*InterfaceType) FindNodeTypeInCallTree

func (s *InterfaceType) FindNodeTypeInCallTree(nodeType NodeType) []Node

FindNodeTypeInCallTree returns all nodes in call tree of a certain type

func (*InterfaceType) FindUsages

func (s *InterfaceType) FindUsages(declaration *Ident) []*Ident

FindUsages finds usages of given declaration

func (*InterfaceType) FindVarDeclarations

func (s *InterfaceType) FindVarDeclarations() []*Ident

FindVarDeclarations finds all assignStmt (:=), valueSpec (var, const) declarations

func (*InterfaceType) GetScope

func (s *InterfaceType) GetScope() (Node, *types.Scope)

GetScope returns the scope of the node

func (*InterfaceType) GetSource

func (s *InterfaceType) GetSource() []byte

GetSource returns the source code of the current node

func (*InterfaceType) GetSourceString

func (s *InterfaceType) GetSourceString() string

GetSourceString is a convenience function to GetSource as string

func (*InterfaceType) Info

func (s *InterfaceType) Info() *types.Info

Info returns the types.info node.

func (*InterfaceType) IsContainedByType

func (s *InterfaceType) IsContainedByType(nodeType NodeType) bool

IsContainedByType checks if node is contained by a node of given node type

func (*InterfaceType) IsNodeType

func (s *InterfaceType) IsNodeType(nodeType NodeType) bool

IsNodeType checks if node is of given node type

func (*InterfaceType) IsValueType

func (s *InterfaceType) IsValueType(valType string) bool

IsValueType checks if value type is of given type

func (*InterfaceType) Level

func (s *InterfaceType) Level() int

Level returns the level counted from instantiated node = 0

func (*InterfaceType) Match

func (s *InterfaceType) Match(regex regexp.Regexp) bool

Match matches the source code of current node and content with given regex

func (*InterfaceType) NextParentByType

func (s *InterfaceType) NextParentByType(nodeType NodeType) Node

NextParentByType returns the next parent of given type

func (*InterfaceType) NodeType

func (s *InterfaceType) NodeType() NodeType

NodeType returns the NodeType of the node

func (*InterfaceType) Object

func (s *InterfaceType) Object() types.Object

Object returns the object of an identifier, nil otherwise

func (*InterfaceType) Parent

func (s *InterfaceType) Parent() Node

Parent return the parent node

func (*InterfaceType) Parents

func (s *InterfaceType) Parents() []Node

Parents returns the parent path of nodes

func (*InterfaceType) Pkg

func (s *InterfaceType) Pkg() *Package

Pkg returns the package this node belongs to.

func (*InterfaceType) Siblings

func (s *InterfaceType) Siblings() []Node

Siblings returns all sibling nodes

func (*InterfaceType) TreeNode

func (s *InterfaceType) TreeNode(cond func(n Node) bool) Node

TreeNode walks the child tree returning the first node that meets the condition

func (*InterfaceType) TreeNodes

func (s *InterfaceType) TreeNodes(cond func(n Node) bool) []Node

TreeNodes walks the child tree collecting all nodes that meet the condition

func (*InterfaceType) ValueType

func (s *InterfaceType) ValueType() types.Type

ValueType returns value type information of an expression, nil otherwise

func (*InterfaceType) Visit

func (s *InterfaceType) Visit(node ast.Node) ast.Visitor

Visit implements the ast.Visitor interface and is used to walk the underlying ast.Node tree

func (*InterfaceType) Walk

func (s *InterfaceType) Walk(f func(node Node) bool)

Walk traverses the tree and its children. return false to skip children of the current element

type KeyValueExpr

type KeyValueExpr struct {
	*ast.KeyValueExpr
	// contains filtered or unexported fields
}

KeyValueExpr wraps ast.KeyValueExpr

func (*KeyValueExpr) AstNode

func (s *KeyValueExpr) AstNode() ast.Node

AstNode returns the original ast.Node

func (KeyValueExpr) CallTreeNode

func (s KeyValueExpr) CallTreeNode(cond func(n Node) bool) Node

CallTreeNode walks the call tree returning the first node that meets the condition

func (KeyValueExpr) CallTreeNodes

func (s KeyValueExpr) CallTreeNodes(cond func(n Node) bool) []Node

CallTreeNodes walks the call tree collecting all nodes that meet the condition

func (*KeyValueExpr) ChildByName

func (s *KeyValueExpr) ChildByName(name string) Node

ChildByName retrieves a node among the direkt children by name (only nodes that have a name)

func (*KeyValueExpr) ChildByNodeType

func (s *KeyValueExpr) ChildByNodeType(nodeType NodeType) Node

ChildByNodeType returns the first child of a certain type.

func (*KeyValueExpr) ChildNode

func (s *KeyValueExpr) ChildNode(cond func(n Node) bool) Node

ChildNode walks only child nodes returning the first node that meets the condition

func (*KeyValueExpr) ChildNodes

func (s *KeyValueExpr) ChildNodes(cond func(n Node) bool) []Node

ChildNodes walks only child nodes collecting all nodes that meet the condition

func (*KeyValueExpr) Children

func (s *KeyValueExpr) Children() []Node

Children returns all child nodes

func (*KeyValueExpr) ChildrenByNodeType

func (s *KeyValueExpr) ChildrenByNodeType(nodeType NodeType) []Node

ChildrenByNodeType returns the first child of a certain type.

func (*KeyValueExpr) Contains

func (s *KeyValueExpr) Contains(node Node) bool

Contains checks if a node contains another node

func (*KeyValueExpr) FindByName

func (s *KeyValueExpr) FindByName(name string) []Node

FindByName looks for a name in the entire sub tree

func (*KeyValueExpr) FindByNodeType

func (s *KeyValueExpr) FindByNodeType(nodeType NodeType) []Node

FindByNodeType returns all sub nodes of a certain type

func (*KeyValueExpr) FindByToken

func (s *KeyValueExpr) FindByToken(t token.Token) []Node

FindByToken finds a node with a token.Token attached and of given token type

func (*KeyValueExpr) FindByValueType

func (s *KeyValueExpr) FindByValueType(valType string) []Node

FindByValueType find all nodes with given value type

func (*KeyValueExpr) FindDeclarations

func (s *KeyValueExpr) FindDeclarations() []*Ident

FindDeclarations finds all declarations

func (*KeyValueExpr) FindDeclarationsByType

func (s *KeyValueExpr) FindDeclarationsByType(nodeType NodeType) []*Ident

FindDeclarationsByType finds all declarations by (parent) type

func (*KeyValueExpr) FindFirstByName

func (s *KeyValueExpr) FindFirstByName(name string) Node

FindFirstByName looks for a name in the entire sub tree. First node is returned if there are multiple.

func (*KeyValueExpr) FindFirstByNodeType

func (s *KeyValueExpr) FindFirstByNodeType(nodeType NodeType) Node

FindFirstByNodeType returns the first sub node of a certain type

func (*KeyValueExpr) FindFirstIdentByName

func (s *KeyValueExpr) FindFirstIdentByName(name string) *Ident

FindFirstIdentByName looks for the first Ident node in subtree with given name

func (*KeyValueExpr) FindFirstUsage

func (s *KeyValueExpr) FindFirstUsage(declaration *Ident) *Ident

FindFirstUsage selects the first usage

func (*KeyValueExpr) FindIdentByName

func (s *KeyValueExpr) FindIdentByName(name string) []*Ident

FindIdentByName looks for Ident nodes in the entire sub tree with given name

func (*KeyValueExpr) FindMaps

func (s *KeyValueExpr) FindMaps() []Node

FindMaps find all nodes with given value type

func (*KeyValueExpr) FindNameInCallTree

func (s *KeyValueExpr) FindNameInCallTree(name string) []Node

FindNameInCallTree returns all nodes in call tree with given name

func (*KeyValueExpr) FindNodeTypeInCallTree

func (s *KeyValueExpr) FindNodeTypeInCallTree(nodeType NodeType) []Node

FindNodeTypeInCallTree returns all nodes in call tree of a certain type

func (*KeyValueExpr) FindUsages

func (s *KeyValueExpr) FindUsages(declaration *Ident) []*Ident

FindUsages finds usages of given declaration

func (*KeyValueExpr) FindVarDeclarations

func (s *KeyValueExpr) FindVarDeclarations() []*Ident

FindVarDeclarations finds all assignStmt (:=), valueSpec (var, const) declarations

func (*KeyValueExpr) GetScope

func (s *KeyValueExpr) GetScope() (Node, *types.Scope)

GetScope returns the scope of the node

func (*KeyValueExpr) GetSource

func (s *KeyValueExpr) GetSource() []byte

GetSource returns the source code of the current node

func (*KeyValueExpr) GetSourceString

func (s *KeyValueExpr) GetSourceString() string

GetSourceString is a convenience function to GetSource as string

func (*KeyValueExpr) Info

func (s *KeyValueExpr) Info() *types.Info

Info returns the types.info node.

func (*KeyValueExpr) IsContainedByType

func (s *KeyValueExpr) IsContainedByType(nodeType NodeType) bool

IsContainedByType checks if node is contained by a node of given node type

func (*KeyValueExpr) IsNodeType

func (s *KeyValueExpr) IsNodeType(nodeType NodeType) bool

IsNodeType checks if node is of given node type

func (*KeyValueExpr) IsValueType

func (s *KeyValueExpr) IsValueType(valType string) bool

IsValueType checks if value type is of given type

func (*KeyValueExpr) Level

func (s *KeyValueExpr) Level() int

Level returns the level counted from instantiated node = 0

func (*KeyValueExpr) Match

func (s *KeyValueExpr) Match(regex regexp.Regexp) bool

Match matches the source code of current node and content with given regex

func (*KeyValueExpr) NextParentByType

func (s *KeyValueExpr) NextParentByType(nodeType NodeType) Node

NextParentByType returns the next parent of given type

func (*KeyValueExpr) NodeType

func (s *KeyValueExpr) NodeType() NodeType

NodeType returns the NodeType of the node

func (*KeyValueExpr) Object

func (s *KeyValueExpr) Object() types.Object

Object returns the object of an identifier, nil otherwise

func (*KeyValueExpr) Parent

func (s *KeyValueExpr) Parent() Node

Parent return the parent node

func (*KeyValueExpr) Parents

func (s *KeyValueExpr) Parents() []Node

Parents returns the parent path of nodes

func (*KeyValueExpr) Pkg

func (s *KeyValueExpr) Pkg() *Package

Pkg returns the package this node belongs to.

func (*KeyValueExpr) Siblings

func (s *KeyValueExpr) Siblings() []Node

Siblings returns all sibling nodes

func (*KeyValueExpr) TreeNode

func (s *KeyValueExpr) TreeNode(cond func(n Node) bool) Node

TreeNode walks the child tree returning the first node that meets the condition

func (*KeyValueExpr) TreeNodes

func (s *KeyValueExpr) TreeNodes(cond func(n Node) bool) []Node

TreeNodes walks the child tree collecting all nodes that meet the condition

func (*KeyValueExpr) ValueType

func (s *KeyValueExpr) ValueType() types.Type

ValueType returns value type information of an expression, nil otherwise

func (*KeyValueExpr) Visit

func (s *KeyValueExpr) Visit(node ast.Node) ast.Visitor

Visit implements the ast.Visitor interface and is used to walk the underlying ast.Node tree

func (*KeyValueExpr) Walk

func (s *KeyValueExpr) Walk(f func(node Node) bool)

Walk traverses the tree and its children. return false to skip children of the current element

type LabeledStmt

type LabeledStmt struct {
	*ast.LabeledStmt
	// contains filtered or unexported fields
}

LabeledStmt wraps ast.LabeledStmt

func (*LabeledStmt) AstNode

func (s *LabeledStmt) AstNode() ast.Node

AstNode returns the original ast.Node

func (LabeledStmt) CallTreeNode

func (s LabeledStmt) CallTreeNode(cond func(n Node) bool) Node

CallTreeNode walks the call tree returning the first node that meets the condition

func (LabeledStmt) CallTreeNodes

func (s LabeledStmt) CallTreeNodes(cond func(n Node) bool) []Node

CallTreeNodes walks the call tree collecting all nodes that meet the condition

func (*LabeledStmt) ChildByName

func (s *LabeledStmt) ChildByName(name string) Node

ChildByName retrieves a node among the direkt children by name (only nodes that have a name)

func (*LabeledStmt) ChildByNodeType

func (s *LabeledStmt) ChildByNodeType(nodeType NodeType) Node

ChildByNodeType returns the first child of a certain type.

func (*LabeledStmt) ChildNode

func (s *LabeledStmt) ChildNode(cond func(n Node) bool) Node

ChildNode walks only child nodes returning the first node that meets the condition

func (*LabeledStmt) ChildNodes

func (s *LabeledStmt) ChildNodes(cond func(n Node) bool) []Node

ChildNodes walks only child nodes collecting all nodes that meet the condition

func (*LabeledStmt) Children

func (s *LabeledStmt) Children() []Node

Children returns all child nodes

func (*LabeledStmt) ChildrenByNodeType

func (s *LabeledStmt) ChildrenByNodeType(nodeType NodeType) []Node

ChildrenByNodeType returns the first child of a certain type.

func (*LabeledStmt) Contains

func (s *LabeledStmt) Contains(node Node) bool

Contains checks if a node contains another node

func (*LabeledStmt) FindByName

func (s *LabeledStmt) FindByName(name string) []Node

FindByName looks for a name in the entire sub tree

func (*LabeledStmt) FindByNodeType

func (s *LabeledStmt) FindByNodeType(nodeType NodeType) []Node

FindByNodeType returns all sub nodes of a certain type

func (*LabeledStmt) FindByToken

func (s *LabeledStmt) FindByToken(t token.Token) []Node

FindByToken finds a node with a token.Token attached and of given token type

func (*LabeledStmt) FindByValueType

func (s *LabeledStmt) FindByValueType(valType string) []Node

FindByValueType find all nodes with given value type

func (*LabeledStmt) FindDeclarations

func (s *LabeledStmt) FindDeclarations() []*Ident

FindDeclarations finds all declarations

func (*LabeledStmt) FindDeclarationsByType

func (s *LabeledStmt) FindDeclarationsByType(nodeType NodeType) []*Ident

FindDeclarationsByType finds all declarations by (parent) type

func (*LabeledStmt) FindFirstByName

func (s *LabeledStmt) FindFirstByName(name string) Node

FindFirstByName looks for a name in the entire sub tree. First node is returned if there are multiple.

func (*LabeledStmt) FindFirstByNodeType

func (s *LabeledStmt) FindFirstByNodeType(nodeType NodeType) Node

FindFirstByNodeType returns the first sub node of a certain type

func (*LabeledStmt) FindFirstIdentByName

func (s *LabeledStmt) FindFirstIdentByName(name string) *Ident

FindFirstIdentByName looks for the first Ident node in subtree with given name

func (*LabeledStmt) FindFirstUsage

func (s *LabeledStmt) FindFirstUsage(declaration *Ident) *Ident

FindFirstUsage selects the first usage

func (*LabeledStmt) FindIdentByName

func (s *LabeledStmt) FindIdentByName(name string) []*Ident

FindIdentByName looks for Ident nodes in the entire sub tree with given name

func (*LabeledStmt) FindMaps

func (s *LabeledStmt) FindMaps() []Node

FindMaps find all nodes with given value type

func (*LabeledStmt) FindNameInCallTree

func (s *LabeledStmt) FindNameInCallTree(name string) []Node

FindNameInCallTree returns all nodes in call tree with given name

func (*LabeledStmt) FindNodeTypeInCallTree

func (s *LabeledStmt) FindNodeTypeInCallTree(nodeType NodeType) []Node

FindNodeTypeInCallTree returns all nodes in call tree of a certain type

func (*LabeledStmt) FindUsages

func (s *LabeledStmt) FindUsages(declaration *Ident) []*Ident

FindUsages finds usages of given declaration

func (*LabeledStmt) FindVarDeclarations

func (s *LabeledStmt) FindVarDeclarations() []*Ident

FindVarDeclarations finds all assignStmt (:=), valueSpec (var, const) declarations

func (*LabeledStmt) GetIdent

func (s *LabeledStmt) GetIdent() *Ident

GetIdent returns the name of the node

func (*LabeledStmt) GetScope

func (s *LabeledStmt) GetScope() (Node, *types.Scope)

GetScope returns the scope of the node

func (*LabeledStmt) GetSource

func (s *LabeledStmt) GetSource() []byte

GetSource returns the source code of the current node

func (*LabeledStmt) GetSourceString

func (s *LabeledStmt) GetSourceString() string

GetSourceString is a convenience function to GetSource as string

func (*LabeledStmt) Info

func (s *LabeledStmt) Info() *types.Info

Info returns the types.info node.

func (*LabeledStmt) IsContainedByType

func (s *LabeledStmt) IsContainedByType(nodeType NodeType) bool

IsContainedByType checks if node is contained by a node of given node type

func (*LabeledStmt) IsNodeType

func (s *LabeledStmt) IsNodeType(nodeType NodeType) bool

IsNodeType checks if node is of given node type

func (*LabeledStmt) IsValueType

func (s *LabeledStmt) IsValueType(valType string) bool

IsValueType checks if value type is of given type

func (*LabeledStmt) Level

func (s *LabeledStmt) Level() int

Level returns the level counted from instantiated node = 0

func (*LabeledStmt) Match

func (s *LabeledStmt) Match(regex regexp.Regexp) bool

Match matches the source code of current node and content with given regex

func (*LabeledStmt) NextParentByType

func (s *LabeledStmt) NextParentByType(nodeType NodeType) Node

NextParentByType returns the next parent of given type

func (*LabeledStmt) NodeName

func (s *LabeledStmt) NodeName() string

NodeName returns the name of the node

func (*LabeledStmt) NodeType

func (s *LabeledStmt) NodeType() NodeType

NodeType returns the NodeType of the node

func (*LabeledStmt) Object

func (s *LabeledStmt) Object() types.Object

Object returns the object of an identifier, nil otherwise

func (*LabeledStmt) Parent

func (s *LabeledStmt) Parent() Node

Parent return the parent node

func (*LabeledStmt) Parents

func (s *LabeledStmt) Parents() []Node

Parents returns the parent path of nodes

func (*LabeledStmt) Pkg

func (s *LabeledStmt) Pkg() *Package

Pkg returns the package this node belongs to.

func (*LabeledStmt) Siblings

func (s *LabeledStmt) Siblings() []Node

Siblings returns all sibling nodes

func (*LabeledStmt) TreeNode

func (s *LabeledStmt) TreeNode(cond func(n Node) bool) Node

TreeNode walks the child tree returning the first node that meets the condition

func (*LabeledStmt) TreeNodes

func (s *LabeledStmt) TreeNodes(cond func(n Node) bool) []Node

TreeNodes walks the child tree collecting all nodes that meet the condition

func (*LabeledStmt) ValueType

func (s *LabeledStmt) ValueType() types.Type

ValueType returns value type information of an expression, nil otherwise

func (*LabeledStmt) Visit

func (s *LabeledStmt) Visit(node ast.Node) ast.Visitor

Visit implements the ast.Visitor interface and is used to walk the underlying ast.Node tree

func (*LabeledStmt) Walk

func (s *LabeledStmt) Walk(f func(node Node) bool)

Walk traverses the tree and its children. return false to skip children of the current element

type MapType

type MapType struct {
	*ast.MapType
	// contains filtered or unexported fields
}

MapType wraps ast.MapType

func (*MapType) AstNode

func (s *MapType) AstNode() ast.Node

AstNode returns the original ast.Node

func (MapType) CallTreeNode

func (s MapType) CallTreeNode(cond func(n Node) bool) Node

CallTreeNode walks the call tree returning the first node that meets the condition

func (MapType) CallTreeNodes

func (s MapType) CallTreeNodes(cond func(n Node) bool) []Node

CallTreeNodes walks the call tree collecting all nodes that meet the condition

func (*MapType) ChildByName

func (s *MapType) ChildByName(name string) Node

ChildByName retrieves a node among the direkt children by name (only nodes that have a name)

func (*MapType) ChildByNodeType

func (s *MapType) ChildByNodeType(nodeType NodeType) Node

ChildByNodeType returns the first child of a certain type.

func (*MapType) ChildNode

func (s *MapType) ChildNode(cond func(n Node) bool) Node

ChildNode walks only child nodes returning the first node that meets the condition

func (*MapType) ChildNodes

func (s *MapType) ChildNodes(cond func(n Node) bool) []Node

ChildNodes walks only child nodes collecting all nodes that meet the condition

func (*MapType) Children

func (s *MapType) Children() []Node

Children returns all child nodes

func (*MapType) ChildrenByNodeType

func (s *MapType) ChildrenByNodeType(nodeType NodeType) []Node

ChildrenByNodeType returns the first child of a certain type.

func (*MapType) Contains

func (s *MapType) Contains(node Node) bool

Contains checks if a node contains another node

func (*MapType) FindByName

func (s *MapType) FindByName(name string) []Node

FindByName looks for a name in the entire sub tree

func (*MapType) FindByNodeType

func (s *MapType) FindByNodeType(nodeType NodeType) []Node

FindByNodeType returns all sub nodes of a certain type

func (*MapType) FindByToken

func (s *MapType) FindByToken(t token.Token) []Node

FindByToken finds a node with a token.Token attached and of given token type

func (*MapType) FindByValueType

func (s *MapType) FindByValueType(valType string) []Node

FindByValueType find all nodes with given value type

func (*MapType) FindDeclarations

func (s *MapType) FindDeclarations() []*Ident

FindDeclarations finds all declarations

func (*MapType) FindDeclarationsByType

func (s *MapType) FindDeclarationsByType(nodeType NodeType) []*Ident

FindDeclarationsByType finds all declarations by (parent) type

func (*MapType) FindFirstByName

func (s *MapType) FindFirstByName(name string) Node

FindFirstByName looks for a name in the entire sub tree. First node is returned if there are multiple.

func (*MapType) FindFirstByNodeType

func (s *MapType) FindFirstByNodeType(nodeType NodeType) Node

FindFirstByNodeType returns the first sub node of a certain type

func (*MapType) FindFirstIdentByName

func (s *MapType) FindFirstIdentByName(name string) *Ident

FindFirstIdentByName looks for the first Ident node in subtree with given name

func (*MapType) FindFirstUsage

func (s *MapType) FindFirstUsage(declaration *Ident) *Ident

FindFirstUsage selects the first usage

func (*MapType) FindIdentByName

func (s *MapType) FindIdentByName(name string) []*Ident

FindIdentByName looks for Ident nodes in the entire sub tree with given name

func (*MapType) FindMaps

func (s *MapType) FindMaps() []Node

FindMaps find all nodes with given value type

func (*MapType) FindNameInCallTree

func (s *MapType) FindNameInCallTree(name string) []Node

FindNameInCallTree returns all nodes in call tree with given name

func (*MapType) FindNodeTypeInCallTree

func (s *MapType) FindNodeTypeInCallTree(nodeType NodeType) []Node

FindNodeTypeInCallTree returns all nodes in call tree of a certain type

func (*MapType) FindUsages

func (s *MapType) FindUsages(declaration *Ident) []*Ident

FindUsages finds usages of given declaration

func (*MapType) FindVarDeclarations

func (s *MapType) FindVarDeclarations() []*Ident

FindVarDeclarations finds all assignStmt (:=), valueSpec (var, const) declarations

func (*MapType) GetScope

func (s *MapType) GetScope() (Node, *types.Scope)

GetScope returns the scope of the node

func (*MapType) GetSource

func (s *MapType) GetSource() []byte

GetSource returns the source code of the current node

func (*MapType) GetSourceString

func (s *MapType) GetSourceString() string

GetSourceString is a convenience function to GetSource as string

func (*MapType) Info

func (s *MapType) Info() *types.Info

Info returns the types.info node.

func (*MapType) IsContainedByType

func (s *MapType) IsContainedByType(nodeType NodeType) bool

IsContainedByType checks if node is contained by a node of given node type

func (*MapType) IsNodeType

func (s *MapType) IsNodeType(nodeType NodeType) bool

IsNodeType checks if node is of given node type

func (*MapType) IsValueType

func (s *MapType) IsValueType(valType string) bool

IsValueType checks if value type is of given type

func (*MapType) Level

func (s *MapType) Level() int

Level returns the level counted from instantiated node = 0

func (*MapType) Match

func (s *MapType) Match(regex regexp.Regexp) bool

Match matches the source code of current node and content with given regex

func (*MapType) NextParentByType

func (s *MapType) NextParentByType(nodeType NodeType) Node

NextParentByType returns the next parent of given type

func (*MapType) NodeType

func (s *MapType) NodeType() NodeType

NodeType returns the NodeType of the node

func (*MapType) Object

func (s *MapType) Object() types.Object

Object returns the object of an identifier, nil otherwise

func (*MapType) Parent

func (s *MapType) Parent() Node

Parent return the parent node

func (*MapType) Parents

func (s *MapType) Parents() []Node

Parents returns the parent path of nodes

func (*MapType) Pkg

func (s *MapType) Pkg() *Package

Pkg returns the package this node belongs to.

func (*MapType) Siblings

func (s *MapType) Siblings() []Node

Siblings returns all sibling nodes

func (*MapType) TreeNode

func (s *MapType) TreeNode(cond func(n Node) bool) Node

TreeNode walks the child tree returning the first node that meets the condition

func (*MapType) TreeNodes

func (s *MapType) TreeNodes(cond func(n Node) bool) []Node

TreeNodes walks the child tree collecting all nodes that meet the condition

func (*MapType) ValueType

func (s *MapType) ValueType() types.Type

ValueType returns value type information of an expression, nil otherwise

func (*MapType) Visit

func (s *MapType) Visit(node ast.Node) ast.Visitor

Visit implements the ast.Visitor interface and is used to walk the underlying ast.Node tree

func (*MapType) Walk

func (s *MapType) Walk(f func(node Node) bool)

Walk traverses the tree and its children. return false to skip children of the current element

type Named

type Named interface {
	// NodeName returns the name of the node
	NodeName() string
}

Named provides an interface for nodes with a name

type Node

type Node interface {
	ast.Node

	Level() int
	AstNode() ast.Node
	IsNodeType(nodeType NodeType) bool
	NodeType() NodeType
	IsValueType(valType string) bool
	ValueType() types.Type
	Object() types.Object
	Info() *types.Info
	Walk(f func(node Node) bool)

	GetScope() (Node, *types.Scope)
	Parent() Node
	Parents() []Node
	NextParentByType(nodeType NodeType) Node
	IsContainedByType(nodeType NodeType) bool
	Siblings() []Node
	Children() []Node
	Contains(node Node) bool
	ChildByName(name string) Node
	ChildrenByNodeType(nodeType NodeType) []Node
	ChildByNodeType(nodeType NodeType) Node

	FindByName(name string) []Node
	FindFirstByName(name string) Node
	FindIdentByName(name string) []*Ident
	FindFirstIdentByName(name string) *Ident
	FindNameInCallTree(name string) []Node
	FindByNodeType(nodeType NodeType) []Node
	FindFirstByNodeType(nodeType NodeType) Node
	FindNodeTypeInCallTree(nodeType NodeType) []Node
	FindByValueType(valType string) []Node
	FindByToken(t token.Token) []Node
	FindMaps() []Node
	FindDeclarations() []*Ident
	FindDeclarationsByType(nodeType NodeType) []*Ident
	FindVarDeclarations() []*Ident
	FindUsages(*Ident) []*Ident

	ChildNodes(cond func(n Node) bool) []Node
	ChildNode(cond func(n Node) bool) Node
	TreeNodes(cond func(n Node) bool) []Node
	TreeNode(cond func(n Node) bool) Node
	CallTreeNodes(cond func(n Node) bool) []Node

	CallTreeNode(cond func(n Node) bool) Node

	GetSource() []byte
	GetSourceString() string
	// contains filtered or unexported methods
}

Node wraps a ast.Node with helpful traversal functions

func NewNode

func NewNode(node ast.Node) Node

NewNode creates a new node

type NodeType

type NodeType string

NodeType defines a node type string to search for type

const (
	NodeTypeComment        NodeType = "*astrav.Comment"
	NodeTypeCommentGroup   NodeType = "*astrav.CommentGroup"
	NodeTypeField          NodeType = "*astrav.Field"
	NodeTypeFieldList      NodeType = "*astrav.FieldList"
	NodeTypeBadExpr        NodeType = "*astrav.BadExpr"
	NodeTypeIdent          NodeType = "*astrav.Ident"
	NodeTypeEllipsis       NodeType = "*astrav.Ellipsis"
	NodeTypeBasicLit       NodeType = "*astrav.BasicLit"
	NodeTypeFuncLit        NodeType = "*astrav.FuncLit"
	NodeTypeCompositeLit   NodeType = "*astrav.CompositeLit"
	NodeTypeParenExpr      NodeType = "*astrav.ParenExpr"
	NodeTypeSelectorExpr   NodeType = "*astrav.SelectorExpr"
	NodeTypeIndexExpr      NodeType = "*astrav.IndexExpr"
	NodeTypeSliceExpr      NodeType = "*astrav.SliceExpr"
	NodeTypeTypeAssertExpr NodeType = "*astrav.TypeAssertExpr"
	NodeTypeCallExpr       NodeType = "*astrav.CallExpr"
	NodeTypeStarExpr       NodeType = "*astrav.StarExpr"
	NodeTypeUnaryExpr      NodeType = "*astrav.UnaryExpr"
	NodeTypeBinaryExpr     NodeType = "*astrav.BinaryExpr"
	NodeTypeKeyValueExpr   NodeType = "*astrav.KeyValueExpr"
	NodeTypeArrayType      NodeType = "*astrav.ArrayType"
	NodeTypeStructType     NodeType = "*astrav.StructType"
	NodeTypeFuncType       NodeType = "*astrav.FuncType"
	NodeTypeInterfaceType  NodeType = "*astrav.InterfaceType"
	NodeTypeMapType        NodeType = "*astrav.MapType"
	NodeTypeChanType       NodeType = "*astrav.ChanType"
	NodeTypeBadStmt        NodeType = "*astrav.BadStmt"
	NodeTypeDeclStmt       NodeType = "*astrav.DeclStmt"
	NodeTypeEmptyStmt      NodeType = "*astrav.EmptyStmt"
	NodeTypeLabeledStmt    NodeType = "*astrav.LabeledStmt"
	NodeTypeExprStmt       NodeType = "*astrav.ExprStmt"
	NodeTypeSendStmt       NodeType = "*astrav.SendStmt"
	NodeTypeIncDecStmt     NodeType = "*astrav.IncDecStmt"
	NodeTypeAssignStmt     NodeType = "*astrav.AssignStmt"
	NodeTypeGoStmt         NodeType = "*astrav.GoStmt"
	NodeTypeDeferStmt      NodeType = "*astrav.DeferStmt"
	NodeTypeReturnStmt     NodeType = "*astrav.ReturnStmt"
	NodeTypeBranchStmt     NodeType = "*astrav.BranchStmt"
	NodeTypeBlockStmt      NodeType = "*astrav.BlockStmt"
	NodeTypeIfStmt         NodeType = "*astrav.IfStmt"
	NodeTypeCaseClause     NodeType = "*astrav.CaseClause"
	NodeTypeSwitchStmt     NodeType = "*astrav.SwitchStmt"
	NodeTypeTypeSwitchStmt NodeType = "*astrav.TypeSwitchStmt"
	NodeTypeCommClause     NodeType = "*astrav.CommClause"
	NodeTypeSelectStmt     NodeType = "*astrav.SelectStmt"
	NodeTypeForStmt        NodeType = "*astrav.ForStmt"
	NodeTypeRangeStmt      NodeType = "*astrav.RangeStmt"
	NodeTypeImportSpec     NodeType = "*astrav.ImportSpec"
	NodeTypeValueSpec      NodeType = "*astrav.ValueSpec"
	NodeTypeTypeSpec       NodeType = "*astrav.TypeSpec"
	NodeTypeBadDecl        NodeType = "*astrav.BadDecl"
	NodeTypeGenDecl        NodeType = "*astrav.GenDecl"
	NodeTypeFuncDecl       NodeType = "*astrav.FuncDecl"
	NodeTypeFile           NodeType = "*astrav.File"
	NodeTypePackage        NodeType = "*astrav.Package"
)

Nodetype contants

type Package

type Package struct {
	*ast.Package
	// contains filtered or unexported fields
}

Package wraps ast.Package

func (*Package) AstNode

func (s *Package) AstNode() ast.Node

AstNode returns the original ast.Node

func (Package) CallTreeNode

func (s Package) CallTreeNode(cond func(n Node) bool) Node

CallTreeNode walks the call tree returning the first node that meets the condition

func (Package) CallTreeNodes

func (s Package) CallTreeNodes(cond func(n Node) bool) []Node

CallTreeNodes walks the call tree collecting all nodes that meet the condition

func (*Package) ChildByName

func (s *Package) ChildByName(name string) Node

ChildByName retrieves a node among the direkt children by name (only nodes that have a name)

func (*Package) ChildByNodeType

func (s *Package) ChildByNodeType(nodeType NodeType) Node

ChildByNodeType returns the first child of a certain type.

func (*Package) ChildNode

func (s *Package) ChildNode(cond func(n Node) bool) Node

ChildNode walks only child nodes returning the first node that meets the condition

func (*Package) ChildNodes

func (s *Package) ChildNodes(cond func(n Node) bool) []Node

ChildNodes walks only child nodes collecting all nodes that meet the condition

func (*Package) Children

func (s *Package) Children() []Node

Children returns all child nodes

func (*Package) ChildrenByNodeType

func (s *Package) ChildrenByNodeType(nodeType NodeType) []Node

ChildrenByNodeType returns the first child of a certain type.

func (*Package) Contains

func (s *Package) Contains(node Node) bool

Contains checks if a node contains another node

func (*Package) FindByName

func (s *Package) FindByName(name string) []Node

FindByName looks for a name in the entire sub tree

func (*Package) FindByNodeType

func (s *Package) FindByNodeType(nodeType NodeType) []Node

FindByNodeType returns all sub nodes of a certain type

func (*Package) FindByToken

func (s *Package) FindByToken(t token.Token) []Node

FindByToken finds a node with a token.Token attached and of given token type

func (*Package) FindByValueType

func (s *Package) FindByValueType(valType string) []Node

FindByValueType find all nodes with given value type

func (*Package) FindDeclarations

func (s *Package) FindDeclarations() []*Ident

FindDeclarations finds all declarations

func (*Package) FindDeclarationsByType

func (s *Package) FindDeclarationsByType(nodeType NodeType) []*Ident

FindDeclarationsByType finds all declarations by (parent) type

func (*Package) FindFirstByName

func (s *Package) FindFirstByName(name string) Node

FindFirstByName looks for a name in the entire sub tree. First node is returned if there are multiple.

func (*Package) FindFirstByNodeType

func (s *Package) FindFirstByNodeType(nodeType NodeType) Node

FindFirstByNodeType returns the first sub node of a certain type

func (*Package) FindFirstIdentByName

func (s *Package) FindFirstIdentByName(name string) *Ident

FindFirstIdentByName looks for the first Ident node in subtree with given name

func (*Package) FindFirstUsage

func (s *Package) FindFirstUsage(declaration *Ident) *Ident

FindFirstUsage selects the first usage

func (*Package) FindIdentByName

func (s *Package) FindIdentByName(name string) []*Ident

FindIdentByName looks for Ident nodes in the entire sub tree with given name

func (*Package) FindMaps

func (s *Package) FindMaps() []Node

FindMaps find all nodes with given value type

func (*Package) FindNameInCallTree

func (s *Package) FindNameInCallTree(name string) []Node

FindNameInCallTree returns all nodes in call tree with given name

func (*Package) FindNodeTypeInCallTree

func (s *Package) FindNodeTypeInCallTree(nodeType NodeType) []Node

FindNodeTypeInCallTree returns all nodes in call tree of a certain type

func (*Package) FindUsages

func (s *Package) FindUsages(declaration *Ident) []*Ident

FindUsages finds usages of given declaration

func (*Package) FindVarDeclarations

func (s *Package) FindVarDeclarations() []*Ident

FindVarDeclarations finds all assignStmt (:=), valueSpec (var, const) declarations

func (*Package) FuncDeclByName

func (s *Package) FuncDeclByName(name string) *FuncDecl

FuncDeclByName returns a func declaration by name

func (*Package) FuncDeclbyCallExpr

func (s *Package) FuncDeclbyCallExpr(node *CallExpr) *FuncDecl

FuncDeclbyCallExpr returns a function declaration from its usage

func (*Package) GetRawFiles

func (s *Package) GetRawFiles() map[string][]byte

GetRawFiles returns the raw files from the package.

func (*Package) GetScope

func (s *Package) GetScope() (Node, *types.Scope)

GetScope returns the scope of the node

func (*Package) GetSource

func (s *Package) GetSource() []byte

GetSource returns the source code of the current node

func (*Package) GetSourceString

func (s *Package) GetSourceString() string

GetSourceString is a convenience function to GetSource as string

func (*Package) Info

func (s *Package) Info() *types.Info

Info returns the types.info node.

func (*Package) IsContainedByType

func (s *Package) IsContainedByType(nodeType NodeType) bool

IsContainedByType checks if node is contained by a node of given node type

func (*Package) IsNodeType

func (s *Package) IsNodeType(nodeType NodeType) bool

IsNodeType checks if node is of given node type

func (*Package) IsValueType

func (s *Package) IsValueType(valType string) bool

IsValueType checks if value type is of given type

func (*Package) Level

func (s *Package) Level() int

Level returns the level counted from instantiated node = 0

func (*Package) Match

func (s *Package) Match(regex regexp.Regexp) bool

Match matches the source code of current node and content with given regex

func (*Package) NextParentByType

func (s *Package) NextParentByType(nodeType NodeType) Node

NextParentByType returns the next parent of given type

func (*Package) NodeType

func (s *Package) NodeType() NodeType

NodeType returns the NodeType of the node

func (*Package) Object

func (s *Package) Object() types.Object

Object returns the object of an identifier, nil otherwise

func (*Package) Parent

func (s *Package) Parent() Node

Parent return the parent node

func (*Package) Parents

func (s *Package) Parents() []Node

Parents returns the parent path of nodes

func (*Package) Pkg

func (s *Package) Pkg() *Package

Pkg returns the package this node belongs to.

func (*Package) Siblings

func (s *Package) Siblings() []Node

Siblings returns all sibling nodes

func (*Package) TreeNode

func (s *Package) TreeNode(cond func(n Node) bool) Node

TreeNode walks the child tree returning the first node that meets the condition

func (*Package) TreeNodes

func (s *Package) TreeNodes(cond func(n Node) bool) []Node

TreeNodes walks the child tree collecting all nodes that meet the condition

func (*Package) ValueType

func (s *Package) ValueType() types.Type

ValueType returns value type information of an expression, nil otherwise

func (*Package) Visit

func (s *Package) Visit(node ast.Node) ast.Visitor

Visit implements the ast.Visitor interface and is used to walk the underlying ast.Node tree

func (*Package) Walk

func (s *Package) Walk(f func(node Node) bool)

Walk traverses the tree and its children. return false to skip children of the current element

type ParenExpr

type ParenExpr struct {
	*ast.ParenExpr
	// contains filtered or unexported fields
}

ParenExpr wraps ast.ParenExpr

func (*ParenExpr) AstNode

func (s *ParenExpr) AstNode() ast.Node

AstNode returns the original ast.Node

func (ParenExpr) CallTreeNode

func (s ParenExpr) CallTreeNode(cond func(n Node) bool) Node

CallTreeNode walks the call tree returning the first node that meets the condition

func (ParenExpr) CallTreeNodes

func (s ParenExpr) CallTreeNodes(cond func(n Node) bool) []Node

CallTreeNodes walks the call tree collecting all nodes that meet the condition

func (*ParenExpr) ChildByName

func (s *ParenExpr) ChildByName(name string) Node

ChildByName retrieves a node among the direkt children by name (only nodes that have a name)

func (*ParenExpr) ChildByNodeType

func (s *ParenExpr) ChildByNodeType(nodeType NodeType) Node

ChildByNodeType returns the first child of a certain type.

func (*ParenExpr) ChildNode

func (s *ParenExpr) ChildNode(cond func(n Node) bool) Node

ChildNode walks only child nodes returning the first node that meets the condition

func (*ParenExpr) ChildNodes

func (s *ParenExpr) ChildNodes(cond func(n Node) bool) []Node

ChildNodes walks only child nodes collecting all nodes that meet the condition

func (*ParenExpr) Children

func (s *ParenExpr) Children() []Node

Children returns all child nodes

func (*ParenExpr) ChildrenByNodeType

func (s *ParenExpr) ChildrenByNodeType(nodeType NodeType) []Node

ChildrenByNodeType returns the first child of a certain type.

func (*ParenExpr) Contains

func (s *ParenExpr) Contains(node Node) bool

Contains checks if a node contains another node

func (*ParenExpr) FindByName

func (s *ParenExpr) FindByName(name string) []Node

FindByName looks for a name in the entire sub tree

func (*ParenExpr) FindByNodeType

func (s *ParenExpr) FindByNodeType(nodeType NodeType) []Node

FindByNodeType returns all sub nodes of a certain type

func (*ParenExpr) FindByToken

func (s *ParenExpr) FindByToken(t token.Token) []Node

FindByToken finds a node with a token.Token attached and of given token type

func (*ParenExpr) FindByValueType

func (s *ParenExpr) FindByValueType(valType string) []Node

FindByValueType find all nodes with given value type

func (*ParenExpr) FindDeclarations

func (s *ParenExpr) FindDeclarations() []*Ident

FindDeclarations finds all declarations

func (*ParenExpr) FindDeclarationsByType

func (s *ParenExpr) FindDeclarationsByType(nodeType NodeType) []*Ident

FindDeclarationsByType finds all declarations by (parent) type

func (*ParenExpr) FindFirstByName

func (s *ParenExpr) FindFirstByName(name string) Node

FindFirstByName looks for a name in the entire sub tree. First node is returned if there are multiple.

func (*ParenExpr) FindFirstByNodeType

func (s *ParenExpr) FindFirstByNodeType(nodeType NodeType) Node

FindFirstByNodeType returns the first sub node of a certain type

func (*ParenExpr) FindFirstIdentByName

func (s *ParenExpr) FindFirstIdentByName(name string) *Ident

FindFirstIdentByName looks for the first Ident node in subtree with given name

func (*ParenExpr) FindFirstUsage

func (s *ParenExpr) FindFirstUsage(declaration *Ident) *Ident

FindFirstUsage selects the first usage

func (*ParenExpr) FindIdentByName

func (s *ParenExpr) FindIdentByName(name string) []*Ident

FindIdentByName looks for Ident nodes in the entire sub tree with given name

func (*ParenExpr) FindMaps

func (s *ParenExpr) FindMaps() []Node

FindMaps find all nodes with given value type

func (*ParenExpr) FindNameInCallTree

func (s *ParenExpr) FindNameInCallTree(name string) []Node

FindNameInCallTree returns all nodes in call tree with given name

func (*ParenExpr) FindNodeTypeInCallTree

func (s *ParenExpr) FindNodeTypeInCallTree(nodeType NodeType) []Node

FindNodeTypeInCallTree returns all nodes in call tree of a certain type

func (*ParenExpr) FindUsages

func (s *ParenExpr) FindUsages(declaration *Ident) []*Ident

FindUsages finds usages of given declaration

func (*ParenExpr) FindVarDeclarations

func (s *ParenExpr) FindVarDeclarations() []*Ident

FindVarDeclarations finds all assignStmt (:=), valueSpec (var, const) declarations

func (*ParenExpr) GetScope

func (s *ParenExpr) GetScope() (Node, *types.Scope)

GetScope returns the scope of the node

func (*ParenExpr) GetSource

func (s *ParenExpr) GetSource() []byte

GetSource returns the source code of the current node

func (*ParenExpr) GetSourceString

func (s *ParenExpr) GetSourceString() string

GetSourceString is a convenience function to GetSource as string

func (*ParenExpr) Info

func (s *ParenExpr) Info() *types.Info

Info returns the types.info node.

func (*ParenExpr) IsContainedByType

func (s *ParenExpr) IsContainedByType(nodeType NodeType) bool

IsContainedByType checks if node is contained by a node of given node type

func (*ParenExpr) IsNodeType

func (s *ParenExpr) IsNodeType(nodeType NodeType) bool

IsNodeType checks if node is of given node type

func (*ParenExpr) IsValueType

func (s *ParenExpr) IsValueType(valType string) bool

IsValueType checks if value type is of given type

func (*ParenExpr) Level

func (s *ParenExpr) Level() int

Level returns the level counted from instantiated node = 0

func (*ParenExpr) Match

func (s *ParenExpr) Match(regex regexp.Regexp) bool

Match matches the source code of current node and content with given regex

func (*ParenExpr) NextParentByType

func (s *ParenExpr) NextParentByType(nodeType NodeType) Node

NextParentByType returns the next parent of given type

func (*ParenExpr) NodeType

func (s *ParenExpr) NodeType() NodeType

NodeType returns the NodeType of the node

func (*ParenExpr) Object

func (s *ParenExpr) Object() types.Object

Object returns the object of an identifier, nil otherwise

func (*ParenExpr) Parent

func (s *ParenExpr) Parent() Node

Parent return the parent node

func (*ParenExpr) Parents

func (s *ParenExpr) Parents() []Node

Parents returns the parent path of nodes

func (*ParenExpr) Pkg

func (s *ParenExpr) Pkg() *Package

Pkg returns the package this node belongs to.

func (*ParenExpr) Siblings

func (s *ParenExpr) Siblings() []Node

Siblings returns all sibling nodes

func (*ParenExpr) TreeNode

func (s *ParenExpr) TreeNode(cond func(n Node) bool) Node

TreeNode walks the child tree returning the first node that meets the condition

func (*ParenExpr) TreeNodes

func (s *ParenExpr) TreeNodes(cond func(n Node) bool) []Node

TreeNodes walks the child tree collecting all nodes that meet the condition

func (*ParenExpr) ValueType

func (s *ParenExpr) ValueType() types.Type

ValueType returns value type information of an expression, nil otherwise

func (*ParenExpr) Visit

func (s *ParenExpr) Visit(node ast.Node) ast.Visitor

Visit implements the ast.Visitor interface and is used to walk the underlying ast.Node tree

func (*ParenExpr) Walk

func (s *ParenExpr) Walk(f func(node Node) bool)

Walk traverses the tree and its children. return false to skip children of the current element

type RangeStmt

type RangeStmt struct {
	*ast.RangeStmt
	// contains filtered or unexported fields
}

RangeStmt wraps ast.RangeStmt

func (*RangeStmt) AstNode

func (s *RangeStmt) AstNode() ast.Node

AstNode returns the original ast.Node

func (RangeStmt) CallTreeNode

func (s RangeStmt) CallTreeNode(cond func(n Node) bool) Node

CallTreeNode walks the call tree returning the first node that meets the condition

func (RangeStmt) CallTreeNodes

func (s RangeStmt) CallTreeNodes(cond func(n Node) bool) []Node

CallTreeNodes walks the call tree collecting all nodes that meet the condition

func (*RangeStmt) ChildByName

func (s *RangeStmt) ChildByName(name string) Node

ChildByName retrieves a node among the direkt children by name (only nodes that have a name)

func (*RangeStmt) ChildByNodeType

func (s *RangeStmt) ChildByNodeType(nodeType NodeType) Node

ChildByNodeType returns the first child of a certain type.

func (*RangeStmt) ChildNode

func (s *RangeStmt) ChildNode(cond func(n Node) bool) Node

ChildNode walks only child nodes returning the first node that meets the condition

func (*RangeStmt) ChildNodes

func (s *RangeStmt) ChildNodes(cond func(n Node) bool) []Node

ChildNodes walks only child nodes collecting all nodes that meet the condition

func (*RangeStmt) Children

func (s *RangeStmt) Children() []Node

Children returns all child nodes

func (*RangeStmt) ChildrenByNodeType

func (s *RangeStmt) ChildrenByNodeType(nodeType NodeType) []Node

ChildrenByNodeType returns the first child of a certain type.

func (*RangeStmt) Contains

func (s *RangeStmt) Contains(node Node) bool

Contains checks if a node contains another node

func (*RangeStmt) FindByName

func (s *RangeStmt) FindByName(name string) []Node

FindByName looks for a name in the entire sub tree

func (*RangeStmt) FindByNodeType

func (s *RangeStmt) FindByNodeType(nodeType NodeType) []Node

FindByNodeType returns all sub nodes of a certain type

func (*RangeStmt) FindByToken

func (s *RangeStmt) FindByToken(t token.Token) []Node

FindByToken finds a node with a token.Token attached and of given token type

func (*RangeStmt) FindByValueType

func (s *RangeStmt) FindByValueType(valType string) []Node

FindByValueType find all nodes with given value type

func (*RangeStmt) FindDeclarations

func (s *RangeStmt) FindDeclarations() []*Ident

FindDeclarations finds all declarations

func (*RangeStmt) FindDeclarationsByType

func (s *RangeStmt) FindDeclarationsByType(nodeType NodeType) []*Ident

FindDeclarationsByType finds all declarations by (parent) type

func (*RangeStmt) FindFirstByName

func (s *RangeStmt) FindFirstByName(name string) Node

FindFirstByName looks for a name in the entire sub tree. First node is returned if there are multiple.

func (*RangeStmt) FindFirstByNodeType

func (s *RangeStmt) FindFirstByNodeType(nodeType NodeType) Node

FindFirstByNodeType returns the first sub node of a certain type

func (*RangeStmt) FindFirstIdentByName

func (s *RangeStmt) FindFirstIdentByName(name string) *Ident

FindFirstIdentByName looks for the first Ident node in subtree with given name

func (*RangeStmt) FindFirstUsage

func (s *RangeStmt) FindFirstUsage(declaration *Ident) *Ident

FindFirstUsage selects the first usage

func (*RangeStmt) FindIdentByName

func (s *RangeStmt) FindIdentByName(name string) []*Ident

FindIdentByName looks for Ident nodes in the entire sub tree with given name

func (*RangeStmt) FindMaps

func (s *RangeStmt) FindMaps() []Node

FindMaps find all nodes with given value type

func (*RangeStmt) FindNameInCallTree

func (s *RangeStmt) FindNameInCallTree(name string) []Node

FindNameInCallTree returns all nodes in call tree with given name

func (*RangeStmt) FindNodeTypeInCallTree

func (s *RangeStmt) FindNodeTypeInCallTree(nodeType NodeType) []Node

FindNodeTypeInCallTree returns all nodes in call tree of a certain type

func (*RangeStmt) FindUsages

func (s *RangeStmt) FindUsages(declaration *Ident) []*Ident

FindUsages finds usages of given declaration

func (*RangeStmt) FindVarDeclarations

func (s *RangeStmt) FindVarDeclarations() []*Ident

FindVarDeclarations finds all assignStmt (:=), valueSpec (var, const) declarations

func (*RangeStmt) GetScope

func (s *RangeStmt) GetScope() (Node, *types.Scope)

GetScope returns the scope of the node

func (*RangeStmt) GetSource

func (s *RangeStmt) GetSource() []byte

GetSource returns the source code of the current node

func (*RangeStmt) GetSourceString

func (s *RangeStmt) GetSourceString() string

GetSourceString is a convenience function to GetSource as string

func (*RangeStmt) Info

func (s *RangeStmt) Info() *types.Info

Info returns the types.info node.

func (*RangeStmt) IsContainedByType

func (s *RangeStmt) IsContainedByType(nodeType NodeType) bool

IsContainedByType checks if node is contained by a node of given node type

func (*RangeStmt) IsNodeType

func (s *RangeStmt) IsNodeType(nodeType NodeType) bool

IsNodeType checks if node is of given node type

func (*RangeStmt) IsValueType

func (s *RangeStmt) IsValueType(valType string) bool

IsValueType checks if value type is of given type

func (*RangeStmt) Key

func (s *RangeStmt) Key() Node

Key returns the key of the range statment

func (*RangeStmt) Level

func (s *RangeStmt) Level() int

Level returns the level counted from instantiated node = 0

func (*RangeStmt) Match

func (s *RangeStmt) Match(regex regexp.Regexp) bool

Match matches the source code of current node and content with given regex

func (*RangeStmt) NextParentByType

func (s *RangeStmt) NextParentByType(nodeType NodeType) Node

NextParentByType returns the next parent of given type

func (*RangeStmt) NodeType

func (s *RangeStmt) NodeType() NodeType

NodeType returns the NodeType of the node

func (*RangeStmt) Object

func (s *RangeStmt) Object() types.Object

Object returns the object of an identifier, nil otherwise

func (*RangeStmt) Parent

func (s *RangeStmt) Parent() Node

Parent return the parent node

func (*RangeStmt) Parents

func (s *RangeStmt) Parents() []Node

Parents returns the parent path of nodes

func (*RangeStmt) Pkg

func (s *RangeStmt) Pkg() *Package

Pkg returns the package this node belongs to.

func (*RangeStmt) Siblings

func (s *RangeStmt) Siblings() []Node

Siblings returns all sibling nodes

func (*RangeStmt) Token

func (s *RangeStmt) Token() token.Token

Token returns the token of the node

func (*RangeStmt) TreeNode

func (s *RangeStmt) TreeNode(cond func(n Node) bool) Node

TreeNode walks the child tree returning the first node that meets the condition

func (*RangeStmt) TreeNodes

func (s *RangeStmt) TreeNodes(cond func(n Node) bool) []Node

TreeNodes walks the child tree collecting all nodes that meet the condition

func (*RangeStmt) Value

func (s *RangeStmt) Value() Node

Value returns the value of the range statment

func (*RangeStmt) ValueType

func (s *RangeStmt) ValueType() types.Type

ValueType returns value type information of an expression, nil otherwise

func (*RangeStmt) Visit

func (s *RangeStmt) Visit(node ast.Node) ast.Visitor

Visit implements the ast.Visitor interface and is used to walk the underlying ast.Node tree

func (*RangeStmt) Walk

func (s *RangeStmt) Walk(f func(node Node) bool)

Walk traverses the tree and its children. return false to skip children of the current element

func (*RangeStmt) X

func (s *RangeStmt) X() Node

X returns the variable to range over

type RawFile

type RawFile struct {
	*token.File
	// contains filtered or unexported fields
}

RawFile is based on token.File to add the source code of the file

func NewRawFile

func NewRawFile(file *token.File, source []byte) *RawFile

NewRawFile creates a new RawFile. RawFile is based on token.File and contains the source code

func (*RawFile) ContainsPos

func (s *RawFile) ContainsPos(pos token.Pos) bool

ContainsPos checks if rawfile cotains a given position or not

func (*RawFile) Source

func (s *RawFile) Source() []byte

Source returns the source code of the file

type ReturnStmt

type ReturnStmt struct {
	*ast.ReturnStmt
	// contains filtered or unexported fields
}

ReturnStmt wraps ast.ReturnStmt

func (*ReturnStmt) AstNode

func (s *ReturnStmt) AstNode() ast.Node

AstNode returns the original ast.Node

func (ReturnStmt) CallTreeNode

func (s ReturnStmt) CallTreeNode(cond func(n Node) bool) Node

CallTreeNode walks the call tree returning the first node that meets the condition

func (ReturnStmt) CallTreeNodes

func (s ReturnStmt) CallTreeNodes(cond func(n Node) bool) []Node

CallTreeNodes walks the call tree collecting all nodes that meet the condition

func (*ReturnStmt) ChildByName

func (s *ReturnStmt) ChildByName(name string) Node

ChildByName retrieves a node among the direkt children by name (only nodes that have a name)

func (*ReturnStmt) ChildByNodeType

func (s *ReturnStmt) ChildByNodeType(nodeType NodeType) Node

ChildByNodeType returns the first child of a certain type.

func (*ReturnStmt) ChildNode

func (s *ReturnStmt) ChildNode(cond func(n Node) bool) Node

ChildNode walks only child nodes returning the first node that meets the condition

func (*ReturnStmt) ChildNodes

func (s *ReturnStmt) ChildNodes(cond func(n Node) bool) []Node

ChildNodes walks only child nodes collecting all nodes that meet the condition

func (*ReturnStmt) Children

func (s *ReturnStmt) Children() []Node

Children returns all child nodes

func (*ReturnStmt) ChildrenByNodeType

func (s *ReturnStmt) ChildrenByNodeType(nodeType NodeType) []Node

ChildrenByNodeType returns the first child of a certain type.

func (*ReturnStmt) Contains

func (s *ReturnStmt) Contains(node Node) bool

Contains checks if a node contains another node

func (*ReturnStmt) FindByName

func (s *ReturnStmt) FindByName(name string) []Node

FindByName looks for a name in the entire sub tree

func (*ReturnStmt) FindByNodeType

func (s *ReturnStmt) FindByNodeType(nodeType NodeType) []Node

FindByNodeType returns all sub nodes of a certain type

func (*ReturnStmt) FindByToken

func (s *ReturnStmt) FindByToken(t token.Token) []Node

FindByToken finds a node with a token.Token attached and of given token type

func (*ReturnStmt) FindByValueType

func (s *ReturnStmt) FindByValueType(valType string) []Node

FindByValueType find all nodes with given value type

func (*ReturnStmt) FindDeclarations

func (s *ReturnStmt) FindDeclarations() []*Ident

FindDeclarations finds all declarations

func (*ReturnStmt) FindDeclarationsByType

func (s *ReturnStmt) FindDeclarationsByType(nodeType NodeType) []*Ident

FindDeclarationsByType finds all declarations by (parent) type

func (*ReturnStmt) FindFirstByName

func (s *ReturnStmt) FindFirstByName(name string) Node

FindFirstByName looks for a name in the entire sub tree. First node is returned if there are multiple.

func (*ReturnStmt) FindFirstByNodeType

func (s *ReturnStmt) FindFirstByNodeType(nodeType NodeType) Node

FindFirstByNodeType returns the first sub node of a certain type

func (*ReturnStmt) FindFirstIdentByName

func (s *ReturnStmt) FindFirstIdentByName(name string) *Ident

FindFirstIdentByName looks for the first Ident node in subtree with given name

func (*ReturnStmt) FindFirstUsage

func (s *ReturnStmt) FindFirstUsage(declaration *Ident) *Ident

FindFirstUsage selects the first usage

func (*ReturnStmt) FindIdentByName

func (s *ReturnStmt) FindIdentByName(name string) []*Ident

FindIdentByName looks for Ident nodes in the entire sub tree with given name

func (*ReturnStmt) FindMaps

func (s *ReturnStmt) FindMaps() []Node

FindMaps find all nodes with given value type

func (*ReturnStmt) FindNameInCallTree

func (s *ReturnStmt) FindNameInCallTree(name string) []Node

FindNameInCallTree returns all nodes in call tree with given name

func (*ReturnStmt) FindNodeTypeInCallTree

func (s *ReturnStmt) FindNodeTypeInCallTree(nodeType NodeType) []Node

FindNodeTypeInCallTree returns all nodes in call tree of a certain type

func (*ReturnStmt) FindUsages

func (s *ReturnStmt) FindUsages(declaration *Ident) []*Ident

FindUsages finds usages of given declaration

func (*ReturnStmt) FindVarDeclarations

func (s *ReturnStmt) FindVarDeclarations() []*Ident

FindVarDeclarations finds all assignStmt (:=), valueSpec (var, const) declarations

func (*ReturnStmt) GetScope

func (s *ReturnStmt) GetScope() (Node, *types.Scope)

GetScope returns the scope of the node

func (*ReturnStmt) GetSource

func (s *ReturnStmt) GetSource() []byte

GetSource returns the source code of the current node

func (*ReturnStmt) GetSourceString

func (s *ReturnStmt) GetSourceString() string

GetSourceString is a convenience function to GetSource as string

func (*ReturnStmt) Info

func (s *ReturnStmt) Info() *types.Info

Info returns the types.info node.

func (*ReturnStmt) IsContainedByType

func (s *ReturnStmt) IsContainedByType(nodeType NodeType) bool

IsContainedByType checks if node is contained by a node of given node type

func (*ReturnStmt) IsNodeType

func (s *ReturnStmt) IsNodeType(nodeType NodeType) bool

IsNodeType checks if node is of given node type

func (*ReturnStmt) IsValueType

func (s *ReturnStmt) IsValueType(valType string) bool

IsValueType checks if value type is of given type

func (*ReturnStmt) Level

func (s *ReturnStmt) Level() int

Level returns the level counted from instantiated node = 0

func (*ReturnStmt) Match

func (s *ReturnStmt) Match(regex regexp.Regexp) bool

Match matches the source code of current node and content with given regex

func (*ReturnStmt) NextParentByType

func (s *ReturnStmt) NextParentByType(nodeType NodeType) Node

NextParentByType returns the next parent of given type

func (*ReturnStmt) NodeType

func (s *ReturnStmt) NodeType() NodeType

NodeType returns the NodeType of the node

func (*ReturnStmt) Object

func (s *ReturnStmt) Object() types.Object

Object returns the object of an identifier, nil otherwise

func (*ReturnStmt) Parent

func (s *ReturnStmt) Parent() Node

Parent return the parent node

func (*ReturnStmt) Parents

func (s *ReturnStmt) Parents() []Node

Parents returns the parent path of nodes

func (*ReturnStmt) Pkg

func (s *ReturnStmt) Pkg() *Package

Pkg returns the package this node belongs to.

func (*ReturnStmt) Siblings

func (s *ReturnStmt) Siblings() []Node

Siblings returns all sibling nodes

func (*ReturnStmt) TreeNode

func (s *ReturnStmt) TreeNode(cond func(n Node) bool) Node

TreeNode walks the child tree returning the first node that meets the condition

func (*ReturnStmt) TreeNodes

func (s *ReturnStmt) TreeNodes(cond func(n Node) bool) []Node

TreeNodes walks the child tree collecting all nodes that meet the condition

func (*ReturnStmt) ValueType

func (s *ReturnStmt) ValueType() types.Type

ValueType returns value type information of an expression, nil otherwise

func (*ReturnStmt) Visit

func (s *ReturnStmt) Visit(node ast.Node) ast.Visitor

Visit implements the ast.Visitor interface and is used to walk the underlying ast.Node tree

func (*ReturnStmt) Walk

func (s *ReturnStmt) Walk(f func(node Node) bool)

Walk traverses the tree and its children. return false to skip children of the current element

type SelectStmt

type SelectStmt struct {
	*ast.SelectStmt
	// contains filtered or unexported fields
}

SelectStmt wraps ast.SelectStmt

func (*SelectStmt) AstNode

func (s *SelectStmt) AstNode() ast.Node

AstNode returns the original ast.Node

func (SelectStmt) CallTreeNode

func (s SelectStmt) CallTreeNode(cond func(n Node) bool) Node

CallTreeNode walks the call tree returning the first node that meets the condition

func (SelectStmt) CallTreeNodes

func (s SelectStmt) CallTreeNodes(cond func(n Node) bool) []Node

CallTreeNodes walks the call tree collecting all nodes that meet the condition

func (*SelectStmt) ChildByName

func (s *SelectStmt) ChildByName(name string) Node

ChildByName retrieves a node among the direkt children by name (only nodes that have a name)

func (*SelectStmt) ChildByNodeType

func (s *SelectStmt) ChildByNodeType(nodeType NodeType) Node

ChildByNodeType returns the first child of a certain type.

func (*SelectStmt) ChildNode

func (s *SelectStmt) ChildNode(cond func(n Node) bool) Node

ChildNode walks only child nodes returning the first node that meets the condition

func (*SelectStmt) ChildNodes

func (s *SelectStmt) ChildNodes(cond func(n Node) bool) []Node

ChildNodes walks only child nodes collecting all nodes that meet the condition

func (*SelectStmt) Children

func (s *SelectStmt) Children() []Node

Children returns all child nodes

func (*SelectStmt) ChildrenByNodeType

func (s *SelectStmt) ChildrenByNodeType(nodeType NodeType) []Node

ChildrenByNodeType returns the first child of a certain type.

func (*SelectStmt) Contains

func (s *SelectStmt) Contains(node Node) bool

Contains checks if a node contains another node

func (*SelectStmt) FindByName

func (s *SelectStmt) FindByName(name string) []Node

FindByName looks for a name in the entire sub tree

func (*SelectStmt) FindByNodeType

func (s *SelectStmt) FindByNodeType(nodeType NodeType) []Node

FindByNodeType returns all sub nodes of a certain type

func (*SelectStmt) FindByToken

func (s *SelectStmt) FindByToken(t token.Token) []Node

FindByToken finds a node with a token.Token attached and of given token type

func (*SelectStmt) FindByValueType

func (s *SelectStmt) FindByValueType(valType string) []Node

FindByValueType find all nodes with given value type

func (*SelectStmt) FindDeclarations

func (s *SelectStmt) FindDeclarations() []*Ident

FindDeclarations finds all declarations

func (*SelectStmt) FindDeclarationsByType

func (s *SelectStmt) FindDeclarationsByType(nodeType NodeType) []*Ident

FindDeclarationsByType finds all declarations by (parent) type

func (*SelectStmt) FindFirstByName

func (s *SelectStmt) FindFirstByName(name string) Node

FindFirstByName looks for a name in the entire sub tree. First node is returned if there are multiple.

func (*SelectStmt) FindFirstByNodeType

func (s *SelectStmt) FindFirstByNodeType(nodeType NodeType) Node

FindFirstByNodeType returns the first sub node of a certain type

func (*SelectStmt) FindFirstIdentByName

func (s *SelectStmt) FindFirstIdentByName(name string) *Ident

FindFirstIdentByName looks for the first Ident node in subtree with given name

func (*SelectStmt) FindFirstUsage

func (s *SelectStmt) FindFirstUsage(declaration *Ident) *Ident

FindFirstUsage selects the first usage

func (*SelectStmt) FindIdentByName

func (s *SelectStmt) FindIdentByName(name string) []*Ident

FindIdentByName looks for Ident nodes in the entire sub tree with given name

func (*SelectStmt) FindMaps

func (s *SelectStmt) FindMaps() []Node

FindMaps find all nodes with given value type

func (*SelectStmt) FindNameInCallTree

func (s *SelectStmt) FindNameInCallTree(name string) []Node

FindNameInCallTree returns all nodes in call tree with given name

func (*SelectStmt) FindNodeTypeInCallTree

func (s *SelectStmt) FindNodeTypeInCallTree(nodeType NodeType) []Node

FindNodeTypeInCallTree returns all nodes in call tree of a certain type

func (*SelectStmt) FindUsages

func (s *SelectStmt) FindUsages(declaration *Ident) []*Ident

FindUsages finds usages of given declaration

func (*SelectStmt) FindVarDeclarations

func (s *SelectStmt) FindVarDeclarations() []*Ident

FindVarDeclarations finds all assignStmt (:=), valueSpec (var, const) declarations

func (*SelectStmt) GetScope

func (s *SelectStmt) GetScope() (Node, *types.Scope)

GetScope returns the scope of the node

func (*SelectStmt) GetSource

func (s *SelectStmt) GetSource() []byte

GetSource returns the source code of the current node

func (*SelectStmt) GetSourceString

func (s *SelectStmt) GetSourceString() string

GetSourceString is a convenience function to GetSource as string

func (*SelectStmt) Info

func (s *SelectStmt) Info() *types.Info

Info returns the types.info node.

func (*SelectStmt) IsContainedByType

func (s *SelectStmt) IsContainedByType(nodeType NodeType) bool

IsContainedByType checks if node is contained by a node of given node type

func (*SelectStmt) IsNodeType

func (s *SelectStmt) IsNodeType(nodeType NodeType) bool

IsNodeType checks if node is of given node type

func (*SelectStmt) IsValueType

func (s *SelectStmt) IsValueType(valType string) bool

IsValueType checks if value type is of given type

func (*SelectStmt) Level

func (s *SelectStmt) Level() int

Level returns the level counted from instantiated node = 0

func (*SelectStmt) Match

func (s *SelectStmt) Match(regex regexp.Regexp) bool

Match matches the source code of current node and content with given regex

func (*SelectStmt) NextParentByType

func (s *SelectStmt) NextParentByType(nodeType NodeType) Node

NextParentByType returns the next parent of given type

func (*SelectStmt) NodeType

func (s *SelectStmt) NodeType() NodeType

NodeType returns the NodeType of the node

func (*SelectStmt) Object

func (s *SelectStmt) Object() types.Object

Object returns the object of an identifier, nil otherwise

func (*SelectStmt) Parent

func (s *SelectStmt) Parent() Node

Parent return the parent node

func (*SelectStmt) Parents

func (s *SelectStmt) Parents() []Node

Parents returns the parent path of nodes

func (*SelectStmt) Pkg

func (s *SelectStmt) Pkg() *Package

Pkg returns the package this node belongs to.

func (*SelectStmt) Siblings

func (s *SelectStmt) Siblings() []Node

Siblings returns all sibling nodes

func (*SelectStmt) TreeNode

func (s *SelectStmt) TreeNode(cond func(n Node) bool) Node

TreeNode walks the child tree returning the first node that meets the condition

func (*SelectStmt) TreeNodes

func (s *SelectStmt) TreeNodes(cond func(n Node) bool) []Node

TreeNodes walks the child tree collecting all nodes that meet the condition

func (*SelectStmt) ValueType

func (s *SelectStmt) ValueType() types.Type

ValueType returns value type information of an expression, nil otherwise

func (*SelectStmt) Visit

func (s *SelectStmt) Visit(node ast.Node) ast.Visitor

Visit implements the ast.Visitor interface and is used to walk the underlying ast.Node tree

func (*SelectStmt) Walk

func (s *SelectStmt) Walk(f func(node Node) bool)

Walk traverses the tree and its children. return false to skip children of the current element

type SelectorExpr

type SelectorExpr struct {
	*ast.SelectorExpr
	// contains filtered or unexported fields
}

SelectorExpr wraps ast.SelectorExpr

func (*SelectorExpr) AstNode

func (s *SelectorExpr) AstNode() ast.Node

AstNode returns the original ast.Node

func (SelectorExpr) CallTreeNode

func (s SelectorExpr) CallTreeNode(cond func(n Node) bool) Node

CallTreeNode walks the call tree returning the first node that meets the condition

func (SelectorExpr) CallTreeNodes

func (s SelectorExpr) CallTreeNodes(cond func(n Node) bool) []Node

CallTreeNodes walks the call tree collecting all nodes that meet the condition

func (*SelectorExpr) ChildByName

func (s *SelectorExpr) ChildByName(name string) Node

ChildByName retrieves a node among the direkt children by name (only nodes that have a name)

func (*SelectorExpr) ChildByNodeType

func (s *SelectorExpr) ChildByNodeType(nodeType NodeType) Node

ChildByNodeType returns the first child of a certain type.

func (*SelectorExpr) ChildNode

func (s *SelectorExpr) ChildNode(cond func(n Node) bool) Node

ChildNode walks only child nodes returning the first node that meets the condition

func (*SelectorExpr) ChildNodes

func (s *SelectorExpr) ChildNodes(cond func(n Node) bool) []Node

ChildNodes walks only child nodes collecting all nodes that meet the condition

func (*SelectorExpr) Children

func (s *SelectorExpr) Children() []Node

Children returns all child nodes

func (*SelectorExpr) ChildrenByNodeType

func (s *SelectorExpr) ChildrenByNodeType(nodeType NodeType) []Node

ChildrenByNodeType returns the first child of a certain type.

func (*SelectorExpr) Contains

func (s *SelectorExpr) Contains(node Node) bool

Contains checks if a node contains another node

func (*SelectorExpr) FindByName

func (s *SelectorExpr) FindByName(name string) []Node

FindByName looks for a name in the entire sub tree

func (*SelectorExpr) FindByNodeType

func (s *SelectorExpr) FindByNodeType(nodeType NodeType) []Node

FindByNodeType returns all sub nodes of a certain type

func (*SelectorExpr) FindByToken

func (s *SelectorExpr) FindByToken(t token.Token) []Node

FindByToken finds a node with a token.Token attached and of given token type

func (*SelectorExpr) FindByValueType

func (s *SelectorExpr) FindByValueType(valType string) []Node

FindByValueType find all nodes with given value type

func (*SelectorExpr) FindDeclarations

func (s *SelectorExpr) FindDeclarations() []*Ident

FindDeclarations finds all declarations

func (*SelectorExpr) FindDeclarationsByType

func (s *SelectorExpr) FindDeclarationsByType(nodeType NodeType) []*Ident

FindDeclarationsByType finds all declarations by (parent) type

func (*SelectorExpr) FindFirstByName

func (s *SelectorExpr) FindFirstByName(name string) Node

FindFirstByName looks for a name in the entire sub tree. First node is returned if there are multiple.

func (*SelectorExpr) FindFirstByNodeType

func (s *SelectorExpr) FindFirstByNodeType(nodeType NodeType) Node

FindFirstByNodeType returns the first sub node of a certain type

func (*SelectorExpr) FindFirstIdentByName

func (s *SelectorExpr) FindFirstIdentByName(name string) *Ident

FindFirstIdentByName looks for the first Ident node in subtree with given name

func (*SelectorExpr) FindFirstUsage

func (s *SelectorExpr) FindFirstUsage(declaration *Ident) *Ident

FindFirstUsage selects the first usage

func (*SelectorExpr) FindIdentByName

func (s *SelectorExpr) FindIdentByName(name string) []*Ident

FindIdentByName looks for Ident nodes in the entire sub tree with given name

func (*SelectorExpr) FindMaps

func (s *SelectorExpr) FindMaps() []Node

FindMaps find all nodes with given value type

func (*SelectorExpr) FindNameInCallTree

func (s *SelectorExpr) FindNameInCallTree(name string) []Node

FindNameInCallTree returns all nodes in call tree with given name

func (*SelectorExpr) FindNodeTypeInCallTree

func (s *SelectorExpr) FindNodeTypeInCallTree(nodeType NodeType) []Node

FindNodeTypeInCallTree returns all nodes in call tree of a certain type

func (*SelectorExpr) FindUsages

func (s *SelectorExpr) FindUsages(declaration *Ident) []*Ident

FindUsages finds usages of given declaration

func (*SelectorExpr) FindVarDeclarations

func (s *SelectorExpr) FindVarDeclarations() []*Ident

FindVarDeclarations finds all assignStmt (:=), valueSpec (var, const) declarations

func (*SelectorExpr) GetIdent

func (s *SelectorExpr) GetIdent() *Ident

GetIdent returns the name of the node

func (*SelectorExpr) GetScope

func (s *SelectorExpr) GetScope() (Node, *types.Scope)

GetScope returns the scope of the node

func (*SelectorExpr) GetSource

func (s *SelectorExpr) GetSource() []byte

GetSource returns the source code of the current node

func (*SelectorExpr) GetSourceString

func (s *SelectorExpr) GetSourceString() string

GetSourceString is a convenience function to GetSource as string

func (*SelectorExpr) Info

func (s *SelectorExpr) Info() *types.Info

Info returns the types.info node.

func (*SelectorExpr) IsContainedByType

func (s *SelectorExpr) IsContainedByType(nodeType NodeType) bool

IsContainedByType checks if node is contained by a node of given node type

func (*SelectorExpr) IsNodeType

func (s *SelectorExpr) IsNodeType(nodeType NodeType) bool

IsNodeType checks if node is of given node type

func (*SelectorExpr) IsValueType

func (s *SelectorExpr) IsValueType(valType string) bool

IsValueType checks if value type is of given type

func (*SelectorExpr) Level

func (s *SelectorExpr) Level() int

Level returns the level counted from instantiated node = 0

func (*SelectorExpr) Match

func (s *SelectorExpr) Match(regex regexp.Regexp) bool

Match matches the source code of current node and content with given regex

func (*SelectorExpr) NextParentByType

func (s *SelectorExpr) NextParentByType(nodeType NodeType) Node

NextParentByType returns the next parent of given type

func (*SelectorExpr) NodeName

func (s *SelectorExpr) NodeName() string

NodeName returns the name of the node

func (*SelectorExpr) NodeType

func (s *SelectorExpr) NodeType() NodeType

NodeType returns the NodeType of the node

func (*SelectorExpr) Object

func (s *SelectorExpr) Object() types.Object

Object returns the object of an identifier, nil otherwise

func (*SelectorExpr) PackageName

func (s *SelectorExpr) PackageName() *Ident

PackageName returns the package name

func (*SelectorExpr) Parent

func (s *SelectorExpr) Parent() Node

Parent return the parent node

func (*SelectorExpr) Parents

func (s *SelectorExpr) Parents() []Node

Parents returns the parent path of nodes

func (*SelectorExpr) Pkg

func (s *SelectorExpr) Pkg() *Package

Pkg returns the package this node belongs to.

func (*SelectorExpr) Siblings

func (s *SelectorExpr) Siblings() []Node

Siblings returns all sibling nodes

func (*SelectorExpr) TreeNode

func (s *SelectorExpr) TreeNode(cond func(n Node) bool) Node

TreeNode walks the child tree returning the first node that meets the condition

func (*SelectorExpr) TreeNodes

func (s *SelectorExpr) TreeNodes(cond func(n Node) bool) []Node

TreeNodes walks the child tree collecting all nodes that meet the condition

func (*SelectorExpr) ValueType

func (s *SelectorExpr) ValueType() types.Type

ValueType returns value type information of an expression, nil otherwise

func (*SelectorExpr) Visit

func (s *SelectorExpr) Visit(node ast.Node) ast.Visitor

Visit implements the ast.Visitor interface and is used to walk the underlying ast.Node tree

func (*SelectorExpr) Walk

func (s *SelectorExpr) Walk(f func(node Node) bool)

Walk traverses the tree and its children. return false to skip children of the current element

type SendStmt

type SendStmt struct {
	*ast.SendStmt
	// contains filtered or unexported fields
}

SendStmt wraps ast.SendStmt

func (*SendStmt) AstNode

func (s *SendStmt) AstNode() ast.Node

AstNode returns the original ast.Node

func (SendStmt) CallTreeNode

func (s SendStmt) CallTreeNode(cond func(n Node) bool) Node

CallTreeNode walks the call tree returning the first node that meets the condition

func (SendStmt) CallTreeNodes

func (s SendStmt) CallTreeNodes(cond func(n Node) bool) []Node

CallTreeNodes walks the call tree collecting all nodes that meet the condition

func (*SendStmt) ChildByName

func (s *SendStmt) ChildByName(name string) Node

ChildByName retrieves a node among the direkt children by name (only nodes that have a name)

func (*SendStmt) ChildByNodeType

func (s *SendStmt) ChildByNodeType(nodeType NodeType) Node

ChildByNodeType returns the first child of a certain type.

func (*SendStmt) ChildNode

func (s *SendStmt) ChildNode(cond func(n Node) bool) Node

ChildNode walks only child nodes returning the first node that meets the condition

func (*SendStmt) ChildNodes

func (s *SendStmt) ChildNodes(cond func(n Node) bool) []Node

ChildNodes walks only child nodes collecting all nodes that meet the condition

func (*SendStmt) Children

func (s *SendStmt) Children() []Node

Children returns all child nodes

func (*SendStmt) ChildrenByNodeType

func (s *SendStmt) ChildrenByNodeType(nodeType NodeType) []Node

ChildrenByNodeType returns the first child of a certain type.

func (*SendStmt) Contains

func (s *SendStmt) Contains(node Node) bool

Contains checks if a node contains another node

func (*SendStmt) FindByName

func (s *SendStmt) FindByName(name string) []Node

FindByName looks for a name in the entire sub tree

func (*SendStmt) FindByNodeType

func (s *SendStmt) FindByNodeType(nodeType NodeType) []Node

FindByNodeType returns all sub nodes of a certain type

func (*SendStmt) FindByToken

func (s *SendStmt) FindByToken(t token.Token) []Node

FindByToken finds a node with a token.Token attached and of given token type

func (*SendStmt) FindByValueType

func (s *SendStmt) FindByValueType(valType string) []Node

FindByValueType find all nodes with given value type

func (*SendStmt) FindDeclarations

func (s *SendStmt) FindDeclarations() []*Ident

FindDeclarations finds all declarations

func (*SendStmt) FindDeclarationsByType

func (s *SendStmt) FindDeclarationsByType(nodeType NodeType) []*Ident

FindDeclarationsByType finds all declarations by (parent) type

func (*SendStmt) FindFirstByName

func (s *SendStmt) FindFirstByName(name string) Node

FindFirstByName looks for a name in the entire sub tree. First node is returned if there are multiple.

func (*SendStmt) FindFirstByNodeType

func (s *SendStmt) FindFirstByNodeType(nodeType NodeType) Node

FindFirstByNodeType returns the first sub node of a certain type

func (*SendStmt) FindFirstIdentByName

func (s *SendStmt) FindFirstIdentByName(name string) *Ident

FindFirstIdentByName looks for the first Ident node in subtree with given name

func (*SendStmt) FindFirstUsage

func (s *SendStmt) FindFirstUsage(declaration *Ident) *Ident

FindFirstUsage selects the first usage

func (*SendStmt) FindIdentByName

func (s *SendStmt) FindIdentByName(name string) []*Ident

FindIdentByName looks for Ident nodes in the entire sub tree with given name

func (*SendStmt) FindMaps

func (s *SendStmt) FindMaps() []Node

FindMaps find all nodes with given value type

func (*SendStmt) FindNameInCallTree

func (s *SendStmt) FindNameInCallTree(name string) []Node

FindNameInCallTree returns all nodes in call tree with given name

func (*SendStmt) FindNodeTypeInCallTree

func (s *SendStmt) FindNodeTypeInCallTree(nodeType NodeType) []Node

FindNodeTypeInCallTree returns all nodes in call tree of a certain type

func (*SendStmt) FindUsages

func (s *SendStmt) FindUsages(declaration *Ident) []*Ident

FindUsages finds usages of given declaration

func (*SendStmt) FindVarDeclarations

func (s *SendStmt) FindVarDeclarations() []*Ident

FindVarDeclarations finds all assignStmt (:=), valueSpec (var, const) declarations

func (*SendStmt) GetScope

func (s *SendStmt) GetScope() (Node, *types.Scope)

GetScope returns the scope of the node

func (*SendStmt) GetSource

func (s *SendStmt) GetSource() []byte

GetSource returns the source code of the current node

func (*SendStmt) GetSourceString

func (s *SendStmt) GetSourceString() string

GetSourceString is a convenience function to GetSource as string

func (*SendStmt) Info

func (s *SendStmt) Info() *types.Info

Info returns the types.info node.

func (*SendStmt) IsContainedByType

func (s *SendStmt) IsContainedByType(nodeType NodeType) bool

IsContainedByType checks if node is contained by a node of given node type

func (*SendStmt) IsNodeType

func (s *SendStmt) IsNodeType(nodeType NodeType) bool

IsNodeType checks if node is of given node type

func (*SendStmt) IsValueType

func (s *SendStmt) IsValueType(valType string) bool

IsValueType checks if value type is of given type

func (*SendStmt) Level

func (s *SendStmt) Level() int

Level returns the level counted from instantiated node = 0

func (*SendStmt) Match

func (s *SendStmt) Match(regex regexp.Regexp) bool

Match matches the source code of current node and content with given regex

func (*SendStmt) NextParentByType

func (s *SendStmt) NextParentByType(nodeType NodeType) Node

NextParentByType returns the next parent of given type

func (*SendStmt) NodeType

func (s *SendStmt) NodeType() NodeType

NodeType returns the NodeType of the node

func (*SendStmt) Object

func (s *SendStmt) Object() types.Object

Object returns the object of an identifier, nil otherwise

func (*SendStmt) Parent

func (s *SendStmt) Parent() Node

Parent return the parent node

func (*SendStmt) Parents

func (s *SendStmt) Parents() []Node

Parents returns the parent path of nodes

func (*SendStmt) Pkg

func (s *SendStmt) Pkg() *Package

Pkg returns the package this node belongs to.

func (*SendStmt) Siblings

func (s *SendStmt) Siblings() []Node

Siblings returns all sibling nodes

func (*SendStmt) TreeNode

func (s *SendStmt) TreeNode(cond func(n Node) bool) Node

TreeNode walks the child tree returning the first node that meets the condition

func (*SendStmt) TreeNodes

func (s *SendStmt) TreeNodes(cond func(n Node) bool) []Node

TreeNodes walks the child tree collecting all nodes that meet the condition

func (*SendStmt) ValueType

func (s *SendStmt) ValueType() types.Type

ValueType returns value type information of an expression, nil otherwise

func (*SendStmt) Visit

func (s *SendStmt) Visit(node ast.Node) ast.Visitor

Visit implements the ast.Visitor interface and is used to walk the underlying ast.Node tree

func (*SendStmt) Walk

func (s *SendStmt) Walk(f func(node Node) bool)

Walk traverses the tree and its children. return false to skip children of the current element

type SliceExpr

type SliceExpr struct {
	*ast.SliceExpr
	// contains filtered or unexported fields
}

SliceExpr wraps ast.SliceExpr

func (*SliceExpr) AstNode

func (s *SliceExpr) AstNode() ast.Node

AstNode returns the original ast.Node

func (SliceExpr) CallTreeNode

func (s SliceExpr) CallTreeNode(cond func(n Node) bool) Node

CallTreeNode walks the call tree returning the first node that meets the condition

func (SliceExpr) CallTreeNodes

func (s SliceExpr) CallTreeNodes(cond func(n Node) bool) []Node

CallTreeNodes walks the call tree collecting all nodes that meet the condition

func (*SliceExpr) ChildByName

func (s *SliceExpr) ChildByName(name string) Node

ChildByName retrieves a node among the direkt children by name (only nodes that have a name)

func (*SliceExpr) ChildByNodeType

func (s *SliceExpr) ChildByNodeType(nodeType NodeType) Node

ChildByNodeType returns the first child of a certain type.

func (*SliceExpr) ChildNode

func (s *SliceExpr) ChildNode(cond func(n Node) bool) Node

ChildNode walks only child nodes returning the first node that meets the condition

func (*SliceExpr) ChildNodes

func (s *SliceExpr) ChildNodes(cond func(n Node) bool) []Node

ChildNodes walks only child nodes collecting all nodes that meet the condition

func (*SliceExpr) Children

func (s *SliceExpr) Children() []Node

Children returns all child nodes

func (*SliceExpr) ChildrenByNodeType

func (s *SliceExpr) ChildrenByNodeType(nodeType NodeType) []Node

ChildrenByNodeType returns the first child of a certain type.

func (*SliceExpr) Contains

func (s *SliceExpr) Contains(node Node) bool

Contains checks if a node contains another node

func (*SliceExpr) FindByName

func (s *SliceExpr) FindByName(name string) []Node

FindByName looks for a name in the entire sub tree

func (*SliceExpr) FindByNodeType

func (s *SliceExpr) FindByNodeType(nodeType NodeType) []Node

FindByNodeType returns all sub nodes of a certain type

func (*SliceExpr) FindByToken

func (s *SliceExpr) FindByToken(t token.Token) []Node

FindByToken finds a node with a token.Token attached and of given token type

func (*SliceExpr) FindByValueType

func (s *SliceExpr) FindByValueType(valType string) []Node

FindByValueType find all nodes with given value type

func (*SliceExpr) FindDeclarations

func (s *SliceExpr) FindDeclarations() []*Ident

FindDeclarations finds all declarations

func (*SliceExpr) FindDeclarationsByType

func (s *SliceExpr) FindDeclarationsByType(nodeType NodeType) []*Ident

FindDeclarationsByType finds all declarations by (parent) type

func (*SliceExpr) FindFirstByName

func (s *SliceExpr) FindFirstByName(name string) Node

FindFirstByName looks for a name in the entire sub tree. First node is returned if there are multiple.

func (*SliceExpr) FindFirstByNodeType

func (s *SliceExpr) FindFirstByNodeType(nodeType NodeType) Node

FindFirstByNodeType returns the first sub node of a certain type

func (*SliceExpr) FindFirstIdentByName

func (s *SliceExpr) FindFirstIdentByName(name string) *Ident

FindFirstIdentByName looks for the first Ident node in subtree with given name

func (*SliceExpr) FindFirstUsage

func (s *SliceExpr) FindFirstUsage(declaration *Ident) *Ident

FindFirstUsage selects the first usage

func (*SliceExpr) FindIdentByName

func (s *SliceExpr) FindIdentByName(name string) []*Ident

FindIdentByName looks for Ident nodes in the entire sub tree with given name

func (*SliceExpr) FindMaps

func (s *SliceExpr) FindMaps() []Node

FindMaps find all nodes with given value type

func (*SliceExpr) FindNameInCallTree

func (s *SliceExpr) FindNameInCallTree(name string) []Node

FindNameInCallTree returns all nodes in call tree with given name

func (*SliceExpr) FindNodeTypeInCallTree

func (s *SliceExpr) FindNodeTypeInCallTree(nodeType NodeType) []Node

FindNodeTypeInCallTree returns all nodes in call tree of a certain type

func (*SliceExpr) FindUsages

func (s *SliceExpr) FindUsages(declaration *Ident) []*Ident

FindUsages finds usages of given declaration

func (*SliceExpr) FindVarDeclarations

func (s *SliceExpr) FindVarDeclarations() []*Ident

FindVarDeclarations finds all assignStmt (:=), valueSpec (var, const) declarations

func (*SliceExpr) GetScope

func (s *SliceExpr) GetScope() (Node, *types.Scope)

GetScope returns the scope of the node

func (*SliceExpr) GetSource

func (s *SliceExpr) GetSource() []byte

GetSource returns the source code of the current node

func (*SliceExpr) GetSourceString

func (s *SliceExpr) GetSourceString() string

GetSourceString is a convenience function to GetSource as string

func (*SliceExpr) Info

func (s *SliceExpr) Info() *types.Info

Info returns the types.info node.

func (*SliceExpr) IsContainedByType

func (s *SliceExpr) IsContainedByType(nodeType NodeType) bool

IsContainedByType checks if node is contained by a node of given node type

func (*SliceExpr) IsNodeType

func (s *SliceExpr) IsNodeType(nodeType NodeType) bool

IsNodeType checks if node is of given node type

func (*SliceExpr) IsValueType

func (s *SliceExpr) IsValueType(valType string) bool

IsValueType checks if value type is of given type

func (*SliceExpr) Level

func (s *SliceExpr) Level() int

Level returns the level counted from instantiated node = 0

func (*SliceExpr) Match

func (s *SliceExpr) Match(regex regexp.Regexp) bool

Match matches the source code of current node and content with given regex

func (*SliceExpr) NextParentByType

func (s *SliceExpr) NextParentByType(nodeType NodeType) Node

NextParentByType returns the next parent of given type

func (*SliceExpr) NodeType

func (s *SliceExpr) NodeType() NodeType

NodeType returns the NodeType of the node

func (*SliceExpr) Object

func (s *SliceExpr) Object() types.Object

Object returns the object of an identifier, nil otherwise

func (*SliceExpr) Parent

func (s *SliceExpr) Parent() Node

Parent return the parent node

func (*SliceExpr) Parents

func (s *SliceExpr) Parents() []Node

Parents returns the parent path of nodes

func (*SliceExpr) Pkg

func (s *SliceExpr) Pkg() *Package

Pkg returns the package this node belongs to.

func (*SliceExpr) Siblings

func (s *SliceExpr) Siblings() []Node

Siblings returns all sibling nodes

func (*SliceExpr) TreeNode

func (s *SliceExpr) TreeNode(cond func(n Node) bool) Node

TreeNode walks the child tree returning the first node that meets the condition

func (*SliceExpr) TreeNodes

func (s *SliceExpr) TreeNodes(cond func(n Node) bool) []Node

TreeNodes walks the child tree collecting all nodes that meet the condition

func (*SliceExpr) ValueType

func (s *SliceExpr) ValueType() types.Type

ValueType returns value type information of an expression, nil otherwise

func (*SliceExpr) Visit

func (s *SliceExpr) Visit(node ast.Node) ast.Visitor

Visit implements the ast.Visitor interface and is used to walk the underlying ast.Node tree

func (*SliceExpr) Walk

func (s *SliceExpr) Walk(f func(node Node) bool)

Walk traverses the tree and its children. return false to skip children of the current element

type StarExpr

type StarExpr struct {
	*ast.StarExpr
	// contains filtered or unexported fields
}

StarExpr wraps ast.StarExpr

func (*StarExpr) AstNode

func (s *StarExpr) AstNode() ast.Node

AstNode returns the original ast.Node

func (StarExpr) CallTreeNode

func (s StarExpr) CallTreeNode(cond func(n Node) bool) Node

CallTreeNode walks the call tree returning the first node that meets the condition

func (StarExpr) CallTreeNodes

func (s StarExpr) CallTreeNodes(cond func(n Node) bool) []Node

CallTreeNodes walks the call tree collecting all nodes that meet the condition

func (*StarExpr) ChildByName

func (s *StarExpr) ChildByName(name string) Node

ChildByName retrieves a node among the direkt children by name (only nodes that have a name)

func (*StarExpr) ChildByNodeType

func (s *StarExpr) ChildByNodeType(nodeType NodeType) Node

ChildByNodeType returns the first child of a certain type.

func (*StarExpr) ChildNode

func (s *StarExpr) ChildNode(cond func(n Node) bool) Node

ChildNode walks only child nodes returning the first node that meets the condition

func (*StarExpr) ChildNodes

func (s *StarExpr) ChildNodes(cond func(n Node) bool) []Node

ChildNodes walks only child nodes collecting all nodes that meet the condition

func (*StarExpr) Children

func (s *StarExpr) Children() []Node

Children returns all child nodes

func (*StarExpr) ChildrenByNodeType

func (s *StarExpr) ChildrenByNodeType(nodeType NodeType) []Node

ChildrenByNodeType returns the first child of a certain type.

func (*StarExpr) Contains

func (s *StarExpr) Contains(node Node) bool

Contains checks if a node contains another node

func (*StarExpr) FindByName

func (s *StarExpr) FindByName(name string) []Node

FindByName looks for a name in the entire sub tree

func (*StarExpr) FindByNodeType

func (s *StarExpr) FindByNodeType(nodeType NodeType) []Node

FindByNodeType returns all sub nodes of a certain type

func (*StarExpr) FindByToken

func (s *StarExpr) FindByToken(t token.Token) []Node

FindByToken finds a node with a token.Token attached and of given token type

func (*StarExpr) FindByValueType

func (s *StarExpr) FindByValueType(valType string) []Node

FindByValueType find all nodes with given value type

func (*StarExpr) FindDeclarations

func (s *StarExpr) FindDeclarations() []*Ident

FindDeclarations finds all declarations

func (*StarExpr) FindDeclarationsByType

func (s *StarExpr) FindDeclarationsByType(nodeType NodeType) []*Ident

FindDeclarationsByType finds all declarations by (parent) type

func (*StarExpr) FindFirstByName

func (s *StarExpr) FindFirstByName(name string) Node

FindFirstByName looks for a name in the entire sub tree. First node is returned if there are multiple.

func (*StarExpr) FindFirstByNodeType

func (s *StarExpr) FindFirstByNodeType(nodeType NodeType) Node

FindFirstByNodeType returns the first sub node of a certain type

func (*StarExpr) FindFirstIdentByName

func (s *StarExpr) FindFirstIdentByName(name string) *Ident

FindFirstIdentByName looks for the first Ident node in subtree with given name

func (*StarExpr) FindFirstUsage

func (s *StarExpr) FindFirstUsage(declaration *Ident) *Ident

FindFirstUsage selects the first usage

func (*StarExpr) FindIdentByName

func (s *StarExpr) FindIdentByName(name string) []*Ident

FindIdentByName looks for Ident nodes in the entire sub tree with given name

func (*StarExpr) FindMaps

func (s *StarExpr) FindMaps() []Node

FindMaps find all nodes with given value type

func (*StarExpr) FindNameInCallTree

func (s *StarExpr) FindNameInCallTree(name string) []Node

FindNameInCallTree returns all nodes in call tree with given name

func (*StarExpr) FindNodeTypeInCallTree

func (s *StarExpr) FindNodeTypeInCallTree(nodeType NodeType) []Node

FindNodeTypeInCallTree returns all nodes in call tree of a certain type

func (*StarExpr) FindUsages

func (s *StarExpr) FindUsages(declaration *Ident) []*Ident

FindUsages finds usages of given declaration

func (*StarExpr) FindVarDeclarations

func (s *StarExpr) FindVarDeclarations() []*Ident

FindVarDeclarations finds all assignStmt (:=), valueSpec (var, const) declarations

func (*StarExpr) GetScope

func (s *StarExpr) GetScope() (Node, *types.Scope)

GetScope returns the scope of the node

func (*StarExpr) GetSource

func (s *StarExpr) GetSource() []byte

GetSource returns the source code of the current node

func (*StarExpr) GetSourceString

func (s *StarExpr) GetSourceString() string

GetSourceString is a convenience function to GetSource as string

func (*StarExpr) Info

func (s *StarExpr) Info() *types.Info

Info returns the types.info node.

func (*StarExpr) IsContainedByType

func (s *StarExpr) IsContainedByType(nodeType NodeType) bool

IsContainedByType checks if node is contained by a node of given node type

func (*StarExpr) IsNodeType

func (s *StarExpr) IsNodeType(nodeType NodeType) bool

IsNodeType checks if node is of given node type

func (*StarExpr) IsValueType

func (s *StarExpr) IsValueType(valType string) bool

IsValueType checks if value type is of given type

func (*StarExpr) Level

func (s *StarExpr) Level() int

Level returns the level counted from instantiated node = 0

func (*StarExpr) Match

func (s *StarExpr) Match(regex regexp.Regexp) bool

Match matches the source code of current node and content with given regex

func (*StarExpr) NextParentByType

func (s *StarExpr) NextParentByType(nodeType NodeType) Node

NextParentByType returns the next parent of given type

func (*StarExpr) NodeType

func (s *StarExpr) NodeType() NodeType

NodeType returns the NodeType of the node

func (*StarExpr) Object

func (s *StarExpr) Object() types.Object

Object returns the object of an identifier, nil otherwise

func (*StarExpr) Parent

func (s *StarExpr) Parent() Node

Parent return the parent node

func (*StarExpr) Parents

func (s *StarExpr) Parents() []Node

Parents returns the parent path of nodes

func (*StarExpr) Pkg

func (s *StarExpr) Pkg() *Package

Pkg returns the package this node belongs to.

func (*StarExpr) Siblings

func (s *StarExpr) Siblings() []Node

Siblings returns all sibling nodes

func (*StarExpr) TreeNode

func (s *StarExpr) TreeNode(cond func(n Node) bool) Node

TreeNode walks the child tree returning the first node that meets the condition

func (*StarExpr) TreeNodes

func (s *StarExpr) TreeNodes(cond func(n Node) bool) []Node

TreeNodes walks the child tree collecting all nodes that meet the condition

func (*StarExpr) ValueType

func (s *StarExpr) ValueType() types.Type

ValueType returns value type information of an expression, nil otherwise

func (*StarExpr) Visit

func (s *StarExpr) Visit(node ast.Node) ast.Visitor

Visit implements the ast.Visitor interface and is used to walk the underlying ast.Node tree

func (*StarExpr) Walk

func (s *StarExpr) Walk(f func(node Node) bool)

Walk traverses the tree and its children. return false to skip children of the current element

type StructType

type StructType struct {
	*ast.StructType
	// contains filtered or unexported fields
}

StructType wraps ast.StructType

func (*StructType) AstNode

func (s *StructType) AstNode() ast.Node

AstNode returns the original ast.Node

func (StructType) CallTreeNode

func (s StructType) CallTreeNode(cond func(n Node) bool) Node

CallTreeNode walks the call tree returning the first node that meets the condition

func (StructType) CallTreeNodes

func (s StructType) CallTreeNodes(cond func(n Node) bool) []Node

CallTreeNodes walks the call tree collecting all nodes that meet the condition

func (*StructType) ChildByName

func (s *StructType) ChildByName(name string) Node

ChildByName retrieves a node among the direkt children by name (only nodes that have a name)

func (*StructType) ChildByNodeType

func (s *StructType) ChildByNodeType(nodeType NodeType) Node

ChildByNodeType returns the first child of a certain type.

func (*StructType) ChildNode

func (s *StructType) ChildNode(cond func(n Node) bool) Node

ChildNode walks only child nodes returning the first node that meets the condition

func (*StructType) ChildNodes

func (s *StructType) ChildNodes(cond func(n Node) bool) []Node

ChildNodes walks only child nodes collecting all nodes that meet the condition

func (*StructType) Children

func (s *StructType) Children() []Node

Children returns all child nodes

func (*StructType) ChildrenByNodeType

func (s *StructType) ChildrenByNodeType(nodeType NodeType) []Node

ChildrenByNodeType returns the first child of a certain type.

func (*StructType) Contains

func (s *StructType) Contains(node Node) bool

Contains checks if a node contains another node

func (*StructType) FindByName

func (s *StructType) FindByName(name string) []Node

FindByName looks for a name in the entire sub tree

func (*StructType) FindByNodeType

func (s *StructType) FindByNodeType(nodeType NodeType) []Node

FindByNodeType returns all sub nodes of a certain type

func (*StructType) FindByToken

func (s *StructType) FindByToken(t token.Token) []Node

FindByToken finds a node with a token.Token attached and of given token type

func (*StructType) FindByValueType

func (s *StructType) FindByValueType(valType string) []Node

FindByValueType find all nodes with given value type

func (*StructType) FindDeclarations

func (s *StructType) FindDeclarations() []*Ident

FindDeclarations finds all declarations

func (*StructType) FindDeclarationsByType

func (s *StructType) FindDeclarationsByType(nodeType NodeType) []*Ident

FindDeclarationsByType finds all declarations by (parent) type

func (*StructType) FindFirstByName

func (s *StructType) FindFirstByName(name string) Node

FindFirstByName looks for a name in the entire sub tree. First node is returned if there are multiple.

func (*StructType) FindFirstByNodeType

func (s *StructType) FindFirstByNodeType(nodeType NodeType) Node

FindFirstByNodeType returns the first sub node of a certain type

func (*StructType) FindFirstIdentByName

func (s *StructType) FindFirstIdentByName(name string) *Ident

FindFirstIdentByName looks for the first Ident node in subtree with given name

func (*StructType) FindFirstUsage

func (s *StructType) FindFirstUsage(declaration *Ident) *Ident

FindFirstUsage selects the first usage

func (*StructType) FindIdentByName

func (s *StructType) FindIdentByName(name string) []*Ident

FindIdentByName looks for Ident nodes in the entire sub tree with given name

func (*StructType) FindMaps

func (s *StructType) FindMaps() []Node

FindMaps find all nodes with given value type

func (*StructType) FindNameInCallTree

func (s *StructType) FindNameInCallTree(name string) []Node

FindNameInCallTree returns all nodes in call tree with given name

func (*StructType) FindNodeTypeInCallTree

func (s *StructType) FindNodeTypeInCallTree(nodeType NodeType) []Node

FindNodeTypeInCallTree returns all nodes in call tree of a certain type

func (*StructType) FindUsages

func (s *StructType) FindUsages(declaration *Ident) []*Ident

FindUsages finds usages of given declaration

func (*StructType) FindVarDeclarations

func (s *StructType) FindVarDeclarations() []*Ident

FindVarDeclarations finds all assignStmt (:=), valueSpec (var, const) declarations

func (*StructType) GetScope

func (s *StructType) GetScope() (Node, *types.Scope)

GetScope returns the scope of the node

func (*StructType) GetSource

func (s *StructType) GetSource() []byte

GetSource returns the source code of the current node

func (*StructType) GetSourceString

func (s *StructType) GetSourceString() string

GetSourceString is a convenience function to GetSource as string

func (*StructType) Info

func (s *StructType) Info() *types.Info

Info returns the types.info node.

func (*StructType) IsContainedByType

func (s *StructType) IsContainedByType(nodeType NodeType) bool

IsContainedByType checks if node is contained by a node of given node type

func (*StructType) IsNodeType

func (s *StructType) IsNodeType(nodeType NodeType) bool

IsNodeType checks if node is of given node type

func (*StructType) IsValueType

func (s *StructType) IsValueType(valType string) bool

IsValueType checks if value type is of given type

func (*StructType) Level

func (s *StructType) Level() int

Level returns the level counted from instantiated node = 0

func (*StructType) Match

func (s *StructType) Match(regex regexp.Regexp) bool

Match matches the source code of current node and content with given regex

func (*StructType) NextParentByType

func (s *StructType) NextParentByType(nodeType NodeType) Node

NextParentByType returns the next parent of given type

func (*StructType) NodeType

func (s *StructType) NodeType() NodeType

NodeType returns the NodeType of the node

func (*StructType) Object

func (s *StructType) Object() types.Object

Object returns the object of an identifier, nil otherwise

func (*StructType) Parent

func (s *StructType) Parent() Node

Parent return the parent node

func (*StructType) Parents

func (s *StructType) Parents() []Node

Parents returns the parent path of nodes

func (*StructType) Pkg

func (s *StructType) Pkg() *Package

Pkg returns the package this node belongs to.

func (*StructType) Siblings

func (s *StructType) Siblings() []Node

Siblings returns all sibling nodes

func (*StructType) TreeNode

func (s *StructType) TreeNode(cond func(n Node) bool) Node

TreeNode walks the child tree returning the first node that meets the condition

func (*StructType) TreeNodes

func (s *StructType) TreeNodes(cond func(n Node) bool) []Node

TreeNodes walks the child tree collecting all nodes that meet the condition

func (*StructType) ValueType

func (s *StructType) ValueType() types.Type

ValueType returns value type information of an expression, nil otherwise

func (*StructType) Visit

func (s *StructType) Visit(node ast.Node) ast.Visitor

Visit implements the ast.Visitor interface and is used to walk the underlying ast.Node tree

func (*StructType) Walk

func (s *StructType) Walk(f func(node Node) bool)

Walk traverses the tree and its children. return false to skip children of the current element

type SwitchStmt

type SwitchStmt struct {
	*ast.SwitchStmt
	// contains filtered or unexported fields
}

SwitchStmt wraps ast.SwitchStmt

func (*SwitchStmt) AstNode

func (s *SwitchStmt) AstNode() ast.Node

AstNode returns the original ast.Node

func (SwitchStmt) CallTreeNode

func (s SwitchStmt) CallTreeNode(cond func(n Node) bool) Node

CallTreeNode walks the call tree returning the first node that meets the condition

func (SwitchStmt) CallTreeNodes

func (s SwitchStmt) CallTreeNodes(cond func(n Node) bool) []Node

CallTreeNodes walks the call tree collecting all nodes that meet the condition

func (*SwitchStmt) ChildByName

func (s *SwitchStmt) ChildByName(name string) Node

ChildByName retrieves a node among the direkt children by name (only nodes that have a name)

func (*SwitchStmt) ChildByNodeType

func (s *SwitchStmt) ChildByNodeType(nodeType NodeType) Node

ChildByNodeType returns the first child of a certain type.

func (*SwitchStmt) ChildNode

func (s *SwitchStmt) ChildNode(cond func(n Node) bool) Node

ChildNode walks only child nodes returning the first node that meets the condition

func (*SwitchStmt) ChildNodes

func (s *SwitchStmt) ChildNodes(cond func(n Node) bool) []Node

ChildNodes walks only child nodes collecting all nodes that meet the condition

func (*SwitchStmt) Children

func (s *SwitchStmt) Children() []Node

Children returns all child nodes

func (*SwitchStmt) ChildrenByNodeType

func (s *SwitchStmt) ChildrenByNodeType(nodeType NodeType) []Node

ChildrenByNodeType returns the first child of a certain type.

func (*SwitchStmt) Contains

func (s *SwitchStmt) Contains(node Node) bool

Contains checks if a node contains another node

func (*SwitchStmt) FindByName

func (s *SwitchStmt) FindByName(name string) []Node

FindByName looks for a name in the entire sub tree

func (*SwitchStmt) FindByNodeType

func (s *SwitchStmt) FindByNodeType(nodeType NodeType) []Node

FindByNodeType returns all sub nodes of a certain type

func (*SwitchStmt) FindByToken

func (s *SwitchStmt) FindByToken(t token.Token) []Node

FindByToken finds a node with a token.Token attached and of given token type

func (*SwitchStmt) FindByValueType

func (s *SwitchStmt) FindByValueType(valType string) []Node

FindByValueType find all nodes with given value type

func (*SwitchStmt) FindDeclarations

func (s *SwitchStmt) FindDeclarations() []*Ident

FindDeclarations finds all declarations

func (*SwitchStmt) FindDeclarationsByType

func (s *SwitchStmt) FindDeclarationsByType(nodeType NodeType) []*Ident

FindDeclarationsByType finds all declarations by (parent) type

func (*SwitchStmt) FindFirstByName

func (s *SwitchStmt) FindFirstByName(name string) Node

FindFirstByName looks for a name in the entire sub tree. First node is returned if there are multiple.

func (*SwitchStmt) FindFirstByNodeType

func (s *SwitchStmt) FindFirstByNodeType(nodeType NodeType) Node

FindFirstByNodeType returns the first sub node of a certain type

func (*SwitchStmt) FindFirstIdentByName

func (s *SwitchStmt) FindFirstIdentByName(name string) *Ident

FindFirstIdentByName looks for the first Ident node in subtree with given name

func (*SwitchStmt) FindFirstUsage

func (s *SwitchStmt) FindFirstUsage(declaration *Ident) *Ident

FindFirstUsage selects the first usage

func (*SwitchStmt) FindIdentByName

func (s *SwitchStmt) FindIdentByName(name string) []*Ident

FindIdentByName looks for Ident nodes in the entire sub tree with given name

func (*SwitchStmt) FindMaps

func (s *SwitchStmt) FindMaps() []Node

FindMaps find all nodes with given value type

func (*SwitchStmt) FindNameInCallTree

func (s *SwitchStmt) FindNameInCallTree(name string) []Node

FindNameInCallTree returns all nodes in call tree with given name

func (*SwitchStmt) FindNodeTypeInCallTree

func (s *SwitchStmt) FindNodeTypeInCallTree(nodeType NodeType) []Node

FindNodeTypeInCallTree returns all nodes in call tree of a certain type

func (*SwitchStmt) FindUsages

func (s *SwitchStmt) FindUsages(declaration *Ident) []*Ident

FindUsages finds usages of given declaration

func (*SwitchStmt) FindVarDeclarations

func (s *SwitchStmt) FindVarDeclarations() []*Ident

FindVarDeclarations finds all assignStmt (:=), valueSpec (var, const) declarations

func (*SwitchStmt) GetScope

func (s *SwitchStmt) GetScope() (Node, *types.Scope)

GetScope returns the scope of the node

func (*SwitchStmt) GetSource

func (s *SwitchStmt) GetSource() []byte

GetSource returns the source code of the current node

func (*SwitchStmt) GetSourceString

func (s *SwitchStmt) GetSourceString() string

GetSourceString is a convenience function to GetSource as string

func (*SwitchStmt) Info

func (s *SwitchStmt) Info() *types.Info

Info returns the types.info node.

func (*SwitchStmt) IsContainedByType

func (s *SwitchStmt) IsContainedByType(nodeType NodeType) bool

IsContainedByType checks if node is contained by a node of given node type

func (*SwitchStmt) IsNodeType

func (s *SwitchStmt) IsNodeType(nodeType NodeType) bool

IsNodeType checks if node is of given node type

func (*SwitchStmt) IsValueType

func (s *SwitchStmt) IsValueType(valType string) bool

IsValueType checks if value type is of given type

func (*SwitchStmt) Level

func (s *SwitchStmt) Level() int

Level returns the level counted from instantiated node = 0

func (*SwitchStmt) Match

func (s *SwitchStmt) Match(regex regexp.Regexp) bool

Match matches the source code of current node and content with given regex

func (*SwitchStmt) NextParentByType

func (s *SwitchStmt) NextParentByType(nodeType NodeType) Node

NextParentByType returns the next parent of given type

func (*SwitchStmt) NodeType

func (s *SwitchStmt) NodeType() NodeType

NodeType returns the NodeType of the node

func (*SwitchStmt) Object

func (s *SwitchStmt) Object() types.Object

Object returns the object of an identifier, nil otherwise

func (*SwitchStmt) Parent

func (s *SwitchStmt) Parent() Node

Parent return the parent node

func (*SwitchStmt) Parents

func (s *SwitchStmt) Parents() []Node

Parents returns the parent path of nodes

func (*SwitchStmt) Pkg

func (s *SwitchStmt) Pkg() *Package

Pkg returns the package this node belongs to.

func (*SwitchStmt) Siblings

func (s *SwitchStmt) Siblings() []Node

Siblings returns all sibling nodes

func (*SwitchStmt) TreeNode

func (s *SwitchStmt) TreeNode(cond func(n Node) bool) Node

TreeNode walks the child tree returning the first node that meets the condition

func (*SwitchStmt) TreeNodes

func (s *SwitchStmt) TreeNodes(cond func(n Node) bool) []Node

TreeNodes walks the child tree collecting all nodes that meet the condition

func (*SwitchStmt) ValueType

func (s *SwitchStmt) ValueType() types.Type

ValueType returns value type information of an expression, nil otherwise

func (*SwitchStmt) Visit

func (s *SwitchStmt) Visit(node ast.Node) ast.Visitor

Visit implements the ast.Visitor interface and is used to walk the underlying ast.Node tree

func (*SwitchStmt) Walk

func (s *SwitchStmt) Walk(f func(node Node) bool)

Walk traverses the tree and its children. return false to skip children of the current element

type Token

type Token interface {
	Token() token.Token
}

Token provides an interface for nodes with a token.Token

type TypeAssertExpr

type TypeAssertExpr struct {
	*ast.TypeAssertExpr
	// contains filtered or unexported fields
}

TypeAssertExpr wraps ast.TypeAssertExpr

func (*TypeAssertExpr) AstNode

func (s *TypeAssertExpr) AstNode() ast.Node

AstNode returns the original ast.Node

func (TypeAssertExpr) CallTreeNode

func (s TypeAssertExpr) CallTreeNode(cond func(n Node) bool) Node

CallTreeNode walks the call tree returning the first node that meets the condition

func (TypeAssertExpr) CallTreeNodes

func (s TypeAssertExpr) CallTreeNodes(cond func(n Node) bool) []Node

CallTreeNodes walks the call tree collecting all nodes that meet the condition

func (*TypeAssertExpr) ChildByName

func (s *TypeAssertExpr) ChildByName(name string) Node

ChildByName retrieves a node among the direkt children by name (only nodes that have a name)

func (*TypeAssertExpr) ChildByNodeType

func (s *TypeAssertExpr) ChildByNodeType(nodeType NodeType) Node

ChildByNodeType returns the first child of a certain type.

func (*TypeAssertExpr) ChildNode

func (s *TypeAssertExpr) ChildNode(cond func(n Node) bool) Node

ChildNode walks only child nodes returning the first node that meets the condition

func (*TypeAssertExpr) ChildNodes

func (s *TypeAssertExpr) ChildNodes(cond func(n Node) bool) []Node

ChildNodes walks only child nodes collecting all nodes that meet the condition

func (*TypeAssertExpr) Children

func (s *TypeAssertExpr) Children() []Node

Children returns all child nodes

func (*TypeAssertExpr) ChildrenByNodeType

func (s *TypeAssertExpr) ChildrenByNodeType(nodeType NodeType) []Node

ChildrenByNodeType returns the first child of a certain type.

func (*TypeAssertExpr) Contains

func (s *TypeAssertExpr) Contains(node Node) bool

Contains checks if a node contains another node

func (*TypeAssertExpr) FindByName

func (s *TypeAssertExpr) FindByName(name string) []Node

FindByName looks for a name in the entire sub tree

func (*TypeAssertExpr) FindByNodeType

func (s *TypeAssertExpr) FindByNodeType(nodeType NodeType) []Node

FindByNodeType returns all sub nodes of a certain type

func (*TypeAssertExpr) FindByToken

func (s *TypeAssertExpr) FindByToken(t token.Token) []Node

FindByToken finds a node with a token.Token attached and of given token type

func (*TypeAssertExpr) FindByValueType

func (s *TypeAssertExpr) FindByValueType(valType string) []Node

FindByValueType find all nodes with given value type

func (*TypeAssertExpr) FindDeclarations

func (s *TypeAssertExpr) FindDeclarations() []*Ident

FindDeclarations finds all declarations

func (*TypeAssertExpr) FindDeclarationsByType

func (s *TypeAssertExpr) FindDeclarationsByType(nodeType NodeType) []*Ident

FindDeclarationsByType finds all declarations by (parent) type

func (*TypeAssertExpr) FindFirstByName

func (s *TypeAssertExpr) FindFirstByName(name string) Node

FindFirstByName looks for a name in the entire sub tree. First node is returned if there are multiple.

func (*TypeAssertExpr) FindFirstByNodeType

func (s *TypeAssertExpr) FindFirstByNodeType(nodeType NodeType) Node

FindFirstByNodeType returns the first sub node of a certain type

func (*TypeAssertExpr) FindFirstIdentByName

func (s *TypeAssertExpr) FindFirstIdentByName(name string) *Ident

FindFirstIdentByName looks for the first Ident node in subtree with given name

func (*TypeAssertExpr) FindFirstUsage

func (s *TypeAssertExpr) FindFirstUsage(declaration *Ident) *Ident

FindFirstUsage selects the first usage

func (*TypeAssertExpr) FindIdentByName

func (s *TypeAssertExpr) FindIdentByName(name string) []*Ident

FindIdentByName looks for Ident nodes in the entire sub tree with given name

func (*TypeAssertExpr) FindMaps

func (s *TypeAssertExpr) FindMaps() []Node

FindMaps find all nodes with given value type

func (*TypeAssertExpr) FindNameInCallTree

func (s *TypeAssertExpr) FindNameInCallTree(name string) []Node

FindNameInCallTree returns all nodes in call tree with given name

func (*TypeAssertExpr) FindNodeTypeInCallTree

func (s *TypeAssertExpr) FindNodeTypeInCallTree(nodeType NodeType) []Node

FindNodeTypeInCallTree returns all nodes in call tree of a certain type

func (*TypeAssertExpr) FindUsages

func (s *TypeAssertExpr) FindUsages(declaration *Ident) []*Ident

FindUsages finds usages of given declaration

func (*TypeAssertExpr) FindVarDeclarations

func (s *TypeAssertExpr) FindVarDeclarations() []*Ident

FindVarDeclarations finds all assignStmt (:=), valueSpec (var, const) declarations

func (*TypeAssertExpr) GetScope

func (s *TypeAssertExpr) GetScope() (Node, *types.Scope)

GetScope returns the scope of the node

func (*TypeAssertExpr) GetSource

func (s *TypeAssertExpr) GetSource() []byte

GetSource returns the source code of the current node

func (*TypeAssertExpr) GetSourceString

func (s *TypeAssertExpr) GetSourceString() string

GetSourceString is a convenience function to GetSource as string

func (*TypeAssertExpr) Info

func (s *TypeAssertExpr) Info() *types.Info

Info returns the types.info node.

func (*TypeAssertExpr) IsContainedByType

func (s *TypeAssertExpr) IsContainedByType(nodeType NodeType) bool

IsContainedByType checks if node is contained by a node of given node type

func (*TypeAssertExpr) IsNodeType

func (s *TypeAssertExpr) IsNodeType(nodeType NodeType) bool

IsNodeType checks if node is of given node type

func (*TypeAssertExpr) IsValueType

func (s *TypeAssertExpr) IsValueType(valType string) bool

IsValueType checks if value type is of given type

func (*TypeAssertExpr) Level

func (s *TypeAssertExpr) Level() int

Level returns the level counted from instantiated node = 0

func (*TypeAssertExpr) Match

func (s *TypeAssertExpr) Match(regex regexp.Regexp) bool

Match matches the source code of current node and content with given regex

func (*TypeAssertExpr) NextParentByType

func (s *TypeAssertExpr) NextParentByType(nodeType NodeType) Node

NextParentByType returns the next parent of given type

func (*TypeAssertExpr) NodeType

func (s *TypeAssertExpr) NodeType() NodeType

NodeType returns the NodeType of the node

func (*TypeAssertExpr) Object

func (s *TypeAssertExpr) Object() types.Object

Object returns the object of an identifier, nil otherwise

func (*TypeAssertExpr) Parent

func (s *TypeAssertExpr) Parent() Node

Parent return the parent node

func (*TypeAssertExpr) Parents

func (s *TypeAssertExpr) Parents() []Node

Parents returns the parent path of nodes

func (*TypeAssertExpr) Pkg

func (s *TypeAssertExpr) Pkg() *Package

Pkg returns the package this node belongs to.

func (*TypeAssertExpr) Siblings

func (s *TypeAssertExpr) Siblings() []Node

Siblings returns all sibling nodes

func (*TypeAssertExpr) TreeNode

func (s *TypeAssertExpr) TreeNode(cond func(n Node) bool) Node

TreeNode walks the child tree returning the first node that meets the condition

func (*TypeAssertExpr) TreeNodes

func (s *TypeAssertExpr) TreeNodes(cond func(n Node) bool) []Node

TreeNodes walks the child tree collecting all nodes that meet the condition

func (*TypeAssertExpr) ValueType

func (s *TypeAssertExpr) ValueType() types.Type

ValueType returns the value type of the node.

func (*TypeAssertExpr) Visit

func (s *TypeAssertExpr) Visit(node ast.Node) ast.Visitor

Visit implements the ast.Visitor interface and is used to walk the underlying ast.Node tree

func (*TypeAssertExpr) Walk

func (s *TypeAssertExpr) Walk(f func(node Node) bool)

Walk traverses the tree and its children. return false to skip children of the current element

type TypeSpec

type TypeSpec struct {
	*ast.TypeSpec
	// contains filtered or unexported fields
}

TypeSpec wraps ast.TypeSpec

func (*TypeSpec) AstNode

func (s *TypeSpec) AstNode() ast.Node

AstNode returns the original ast.Node

func (TypeSpec) CallTreeNode

func (s TypeSpec) CallTreeNode(cond func(n Node) bool) Node

CallTreeNode walks the call tree returning the first node that meets the condition

func (TypeSpec) CallTreeNodes

func (s TypeSpec) CallTreeNodes(cond func(n Node) bool) []Node

CallTreeNodes walks the call tree collecting all nodes that meet the condition

func (*TypeSpec) ChildByName

func (s *TypeSpec) ChildByName(name string) Node

ChildByName retrieves a node among the direkt children by name (only nodes that have a name)

func (*TypeSpec) ChildByNodeType

func (s *TypeSpec) ChildByNodeType(nodeType NodeType) Node

ChildByNodeType returns the first child of a certain type.

func (*TypeSpec) ChildNode

func (s *TypeSpec) ChildNode(cond func(n Node) bool) Node

ChildNode walks only child nodes returning the first node that meets the condition

func (*TypeSpec) ChildNodes

func (s *TypeSpec) ChildNodes(cond func(n Node) bool) []Node

ChildNodes walks only child nodes collecting all nodes that meet the condition

func (*TypeSpec) Children

func (s *TypeSpec) Children() []Node

Children returns all child nodes

func (*TypeSpec) ChildrenByNodeType

func (s *TypeSpec) ChildrenByNodeType(nodeType NodeType) []Node

ChildrenByNodeType returns the first child of a certain type.

func (*TypeSpec) Contains

func (s *TypeSpec) Contains(node Node) bool

Contains checks if a node contains another node

func (*TypeSpec) FindByName

func (s *TypeSpec) FindByName(name string) []Node

FindByName looks for a name in the entire sub tree

func (*TypeSpec) FindByNodeType

func (s *TypeSpec) FindByNodeType(nodeType NodeType) []Node

FindByNodeType returns all sub nodes of a certain type

func (*TypeSpec) FindByToken

func (s *TypeSpec) FindByToken(t token.Token) []Node

FindByToken finds a node with a token.Token attached and of given token type

func (*TypeSpec) FindByValueType

func (s *TypeSpec) FindByValueType(valType string) []Node

FindByValueType find all nodes with given value type

func (*TypeSpec) FindDeclarations

func (s *TypeSpec) FindDeclarations() []*Ident

FindDeclarations finds all declarations

func (*TypeSpec) FindDeclarationsByType

func (s *TypeSpec) FindDeclarationsByType(nodeType NodeType) []*Ident

FindDeclarationsByType finds all declarations by (parent) type

func (*TypeSpec) FindFirstByName

func (s *TypeSpec) FindFirstByName(name string) Node

FindFirstByName looks for a name in the entire sub tree. First node is returned if there are multiple.

func (*TypeSpec) FindFirstByNodeType

func (s *TypeSpec) FindFirstByNodeType(nodeType NodeType) Node

FindFirstByNodeType returns the first sub node of a certain type

func (*TypeSpec) FindFirstIdentByName

func (s *TypeSpec) FindFirstIdentByName(name string) *Ident

FindFirstIdentByName looks for the first Ident node in subtree with given name

func (*TypeSpec) FindFirstUsage

func (s *TypeSpec) FindFirstUsage(declaration *Ident) *Ident

FindFirstUsage selects the first usage

func (*TypeSpec) FindIdentByName

func (s *TypeSpec) FindIdentByName(name string) []*Ident

FindIdentByName looks for Ident nodes in the entire sub tree with given name

func (*TypeSpec) FindMaps

func (s *TypeSpec) FindMaps() []Node

FindMaps find all nodes with given value type

func (*TypeSpec) FindNameInCallTree

func (s *TypeSpec) FindNameInCallTree(name string) []Node

FindNameInCallTree returns all nodes in call tree with given name

func (*TypeSpec) FindNodeTypeInCallTree

func (s *TypeSpec) FindNodeTypeInCallTree(nodeType NodeType) []Node

FindNodeTypeInCallTree returns all nodes in call tree of a certain type

func (*TypeSpec) FindUsages

func (s *TypeSpec) FindUsages(declaration *Ident) []*Ident

FindUsages finds usages of given declaration

func (*TypeSpec) FindVarDeclarations

func (s *TypeSpec) FindVarDeclarations() []*Ident

FindVarDeclarations finds all assignStmt (:=), valueSpec (var, const) declarations

func (*TypeSpec) GetIdent

func (s *TypeSpec) GetIdent() *Ident

GetIdent returns the name of the node

func (*TypeSpec) GetScope

func (s *TypeSpec) GetScope() (Node, *types.Scope)

GetScope returns the scope of the node

func (*TypeSpec) GetSource

func (s *TypeSpec) GetSource() []byte

GetSource returns the source code of the current node

func (*TypeSpec) GetSourceString

func (s *TypeSpec) GetSourceString() string

GetSourceString is a convenience function to GetSource as string

func (*TypeSpec) Info

func (s *TypeSpec) Info() *types.Info

Info returns the types.info node.

func (*TypeSpec) IsContainedByType

func (s *TypeSpec) IsContainedByType(nodeType NodeType) bool

IsContainedByType checks if node is contained by a node of given node type

func (*TypeSpec) IsNodeType

func (s *TypeSpec) IsNodeType(nodeType NodeType) bool

IsNodeType checks if node is of given node type

func (*TypeSpec) IsValueType

func (s *TypeSpec) IsValueType(valType string) bool

IsValueType checks if value type is of given type

func (*TypeSpec) Level

func (s *TypeSpec) Level() int

Level returns the level counted from instantiated node = 0

func (*TypeSpec) Match

func (s *TypeSpec) Match(regex regexp.Regexp) bool

Match matches the source code of current node and content with given regex

func (*TypeSpec) NextParentByType

func (s *TypeSpec) NextParentByType(nodeType NodeType) Node

NextParentByType returns the next parent of given type

func (*TypeSpec) NodeName

func (s *TypeSpec) NodeName() string

NodeName returns the name of the node

func (*TypeSpec) NodeType

func (s *TypeSpec) NodeType() NodeType

NodeType returns the NodeType of the node

func (*TypeSpec) Object

func (s *TypeSpec) Object() types.Object

Object returns the object of an identifier, nil otherwise

func (*TypeSpec) Parent

func (s *TypeSpec) Parent() Node

Parent return the parent node

func (*TypeSpec) Parents

func (s *TypeSpec) Parents() []Node

Parents returns the parent path of nodes

func (*TypeSpec) Pkg

func (s *TypeSpec) Pkg() *Package

Pkg returns the package this node belongs to.

func (*TypeSpec) Siblings

func (s *TypeSpec) Siblings() []Node

Siblings returns all sibling nodes

func (*TypeSpec) TreeNode

func (s *TypeSpec) TreeNode(cond func(n Node) bool) Node

TreeNode walks the child tree returning the first node that meets the condition

func (*TypeSpec) TreeNodes

func (s *TypeSpec) TreeNodes(cond func(n Node) bool) []Node

TreeNodes walks the child tree collecting all nodes that meet the condition

func (*TypeSpec) ValueType

func (s *TypeSpec) ValueType() types.Type

ValueType returns the value type of the node.

func (*TypeSpec) Visit

func (s *TypeSpec) Visit(node ast.Node) ast.Visitor

Visit implements the ast.Visitor interface and is used to walk the underlying ast.Node tree

func (*TypeSpec) Walk

func (s *TypeSpec) Walk(f func(node Node) bool)

Walk traverses the tree and its children. return false to skip children of the current element

type TypeSwitchStmt

type TypeSwitchStmt struct {
	*ast.TypeSwitchStmt
	// contains filtered or unexported fields
}

TypeSwitchStmt wraps ast.TypeSwitchStmt

func (*TypeSwitchStmt) AstNode

func (s *TypeSwitchStmt) AstNode() ast.Node

AstNode returns the original ast.Node

func (TypeSwitchStmt) CallTreeNode

func (s TypeSwitchStmt) CallTreeNode(cond func(n Node) bool) Node

CallTreeNode walks the call tree returning the first node that meets the condition

func (TypeSwitchStmt) CallTreeNodes

func (s TypeSwitchStmt) CallTreeNodes(cond func(n Node) bool) []Node

CallTreeNodes walks the call tree collecting all nodes that meet the condition

func (*TypeSwitchStmt) ChildByName

func (s *TypeSwitchStmt) ChildByName(name string) Node

ChildByName retrieves a node among the direkt children by name (only nodes that have a name)

func (*TypeSwitchStmt) ChildByNodeType

func (s *TypeSwitchStmt) ChildByNodeType(nodeType NodeType) Node

ChildByNodeType returns the first child of a certain type.

func (*TypeSwitchStmt) ChildNode

func (s *TypeSwitchStmt) ChildNode(cond func(n Node) bool) Node

ChildNode walks only child nodes returning the first node that meets the condition

func (*TypeSwitchStmt) ChildNodes

func (s *TypeSwitchStmt) ChildNodes(cond func(n Node) bool) []Node

ChildNodes walks only child nodes collecting all nodes that meet the condition

func (*TypeSwitchStmt) Children

func (s *TypeSwitchStmt) Children() []Node

Children returns all child nodes

func (*TypeSwitchStmt) ChildrenByNodeType

func (s *TypeSwitchStmt) ChildrenByNodeType(nodeType NodeType) []Node

ChildrenByNodeType returns the first child of a certain type.

func (*TypeSwitchStmt) Contains

func (s *TypeSwitchStmt) Contains(node Node) bool

Contains checks if a node contains another node

func (*TypeSwitchStmt) FindByName

func (s *TypeSwitchStmt) FindByName(name string) []Node

FindByName looks for a name in the entire sub tree

func (*TypeSwitchStmt) FindByNodeType

func (s *TypeSwitchStmt) FindByNodeType(nodeType NodeType) []Node

FindByNodeType returns all sub nodes of a certain type

func (*TypeSwitchStmt) FindByToken

func (s *TypeSwitchStmt) FindByToken(t token.Token) []Node

FindByToken finds a node with a token.Token attached and of given token type

func (*TypeSwitchStmt) FindByValueType

func (s *TypeSwitchStmt) FindByValueType(valType string) []Node

FindByValueType find all nodes with given value type

func (*TypeSwitchStmt) FindDeclarations

func (s *TypeSwitchStmt) FindDeclarations() []*Ident

FindDeclarations finds all declarations

func (*TypeSwitchStmt) FindDeclarationsByType

func (s *TypeSwitchStmt) FindDeclarationsByType(nodeType NodeType) []*Ident

FindDeclarationsByType finds all declarations by (parent) type

func (*TypeSwitchStmt) FindFirstByName

func (s *TypeSwitchStmt) FindFirstByName(name string) Node

FindFirstByName looks for a name in the entire sub tree. First node is returned if there are multiple.

func (*TypeSwitchStmt) FindFirstByNodeType

func (s *TypeSwitchStmt) FindFirstByNodeType(nodeType NodeType) Node

FindFirstByNodeType returns the first sub node of a certain type

func (*TypeSwitchStmt) FindFirstIdentByName

func (s *TypeSwitchStmt) FindFirstIdentByName(name string) *Ident

FindFirstIdentByName looks for the first Ident node in subtree with given name

func (*TypeSwitchStmt) FindFirstUsage

func (s *TypeSwitchStmt) FindFirstUsage(declaration *Ident) *Ident

FindFirstUsage selects the first usage

func (*TypeSwitchStmt) FindIdentByName

func (s *TypeSwitchStmt) FindIdentByName(name string) []*Ident

FindIdentByName looks for Ident nodes in the entire sub tree with given name

func (*TypeSwitchStmt) FindMaps

func (s *TypeSwitchStmt) FindMaps() []Node

FindMaps find all nodes with given value type

func (*TypeSwitchStmt) FindNameInCallTree

func (s *TypeSwitchStmt) FindNameInCallTree(name string) []Node

FindNameInCallTree returns all nodes in call tree with given name

func (*TypeSwitchStmt) FindNodeTypeInCallTree

func (s *TypeSwitchStmt) FindNodeTypeInCallTree(nodeType NodeType) []Node

FindNodeTypeInCallTree returns all nodes in call tree of a certain type

func (*TypeSwitchStmt) FindUsages

func (s *TypeSwitchStmt) FindUsages(declaration *Ident) []*Ident

FindUsages finds usages of given declaration

func (*TypeSwitchStmt) FindVarDeclarations

func (s *TypeSwitchStmt) FindVarDeclarations() []*Ident

FindVarDeclarations finds all assignStmt (:=), valueSpec (var, const) declarations

func (*TypeSwitchStmt) GetScope

func (s *TypeSwitchStmt) GetScope() (Node, *types.Scope)

GetScope returns the scope of the node

func (*TypeSwitchStmt) GetSource

func (s *TypeSwitchStmt) GetSource() []byte

GetSource returns the source code of the current node

func (*TypeSwitchStmt) GetSourceString

func (s *TypeSwitchStmt) GetSourceString() string

GetSourceString is a convenience function to GetSource as string

func (*TypeSwitchStmt) Info

func (s *TypeSwitchStmt) Info() *types.Info

Info returns the types.info node.

func (*TypeSwitchStmt) IsContainedByType

func (s *TypeSwitchStmt) IsContainedByType(nodeType NodeType) bool

IsContainedByType checks if node is contained by a node of given node type

func (*TypeSwitchStmt) IsNodeType

func (s *TypeSwitchStmt) IsNodeType(nodeType NodeType) bool

IsNodeType checks if node is of given node type

func (*TypeSwitchStmt) IsValueType

func (s *TypeSwitchStmt) IsValueType(valType string) bool

IsValueType checks if value type is of given type

func (*TypeSwitchStmt) Level

func (s *TypeSwitchStmt) Level() int

Level returns the level counted from instantiated node = 0

func (*TypeSwitchStmt) Match

func (s *TypeSwitchStmt) Match(regex regexp.Regexp) bool

Match matches the source code of current node and content with given regex

func (*TypeSwitchStmt) NextParentByType

func (s *TypeSwitchStmt) NextParentByType(nodeType NodeType) Node

NextParentByType returns the next parent of given type

func (*TypeSwitchStmt) NodeType

func (s *TypeSwitchStmt) NodeType() NodeType

NodeType returns the NodeType of the node

func (*TypeSwitchStmt) Object

func (s *TypeSwitchStmt) Object() types.Object

Object returns the object of an identifier, nil otherwise

func (*TypeSwitchStmt) Parent

func (s *TypeSwitchStmt) Parent() Node

Parent return the parent node

func (*TypeSwitchStmt) Parents

func (s *TypeSwitchStmt) Parents() []Node

Parents returns the parent path of nodes

func (*TypeSwitchStmt) Pkg

func (s *TypeSwitchStmt) Pkg() *Package

Pkg returns the package this node belongs to.

func (*TypeSwitchStmt) Siblings

func (s *TypeSwitchStmt) Siblings() []Node

Siblings returns all sibling nodes

func (*TypeSwitchStmt) TreeNode

func (s *TypeSwitchStmt) TreeNode(cond func(n Node) bool) Node

TreeNode walks the child tree returning the first node that meets the condition

func (*TypeSwitchStmt) TreeNodes

func (s *TypeSwitchStmt) TreeNodes(cond func(n Node) bool) []Node

TreeNodes walks the child tree collecting all nodes that meet the condition

func (*TypeSwitchStmt) ValueType

func (s *TypeSwitchStmt) ValueType() types.Type

ValueType returns value type information of an expression, nil otherwise

func (*TypeSwitchStmt) Visit

func (s *TypeSwitchStmt) Visit(node ast.Node) ast.Visitor

Visit implements the ast.Visitor interface and is used to walk the underlying ast.Node tree

func (*TypeSwitchStmt) Walk

func (s *TypeSwitchStmt) Walk(f func(node Node) bool)

Walk traverses the tree and its children. return false to skip children of the current element

type UnaryExpr

type UnaryExpr struct {
	*ast.UnaryExpr
	// contains filtered or unexported fields
}

UnaryExpr wraps ast.UnaryExpr

func (*UnaryExpr) AstNode

func (s *UnaryExpr) AstNode() ast.Node

AstNode returns the original ast.Node

func (UnaryExpr) CallTreeNode

func (s UnaryExpr) CallTreeNode(cond func(n Node) bool) Node

CallTreeNode walks the call tree returning the first node that meets the condition

func (UnaryExpr) CallTreeNodes

func (s UnaryExpr) CallTreeNodes(cond func(n Node) bool) []Node

CallTreeNodes walks the call tree collecting all nodes that meet the condition

func (*UnaryExpr) ChildByName

func (s *UnaryExpr) ChildByName(name string) Node

ChildByName retrieves a node among the direkt children by name (only nodes that have a name)

func (*UnaryExpr) ChildByNodeType

func (s *UnaryExpr) ChildByNodeType(nodeType NodeType) Node

ChildByNodeType returns the first child of a certain type.

func (*UnaryExpr) ChildNode

func (s *UnaryExpr) ChildNode(cond func(n Node) bool) Node

ChildNode walks only child nodes returning the first node that meets the condition

func (*UnaryExpr) ChildNodes

func (s *UnaryExpr) ChildNodes(cond func(n Node) bool) []Node

ChildNodes walks only child nodes collecting all nodes that meet the condition

func (*UnaryExpr) Children

func (s *UnaryExpr) Children() []Node

Children returns all child nodes

func (*UnaryExpr) ChildrenByNodeType

func (s *UnaryExpr) ChildrenByNodeType(nodeType NodeType) []Node

ChildrenByNodeType returns the first child of a certain type.

func (*UnaryExpr) Contains

func (s *UnaryExpr) Contains(node Node) bool

Contains checks if a node contains another node

func (*UnaryExpr) FindByName

func (s *UnaryExpr) FindByName(name string) []Node

FindByName looks for a name in the entire sub tree

func (*UnaryExpr) FindByNodeType

func (s *UnaryExpr) FindByNodeType(nodeType NodeType) []Node

FindByNodeType returns all sub nodes of a certain type

func (*UnaryExpr) FindByToken

func (s *UnaryExpr) FindByToken(t token.Token) []Node

FindByToken finds a node with a token.Token attached and of given token type

func (*UnaryExpr) FindByValueType

func (s *UnaryExpr) FindByValueType(valType string) []Node

FindByValueType find all nodes with given value type

func (*UnaryExpr) FindDeclarations

func (s *UnaryExpr) FindDeclarations() []*Ident

FindDeclarations finds all declarations

func (*UnaryExpr) FindDeclarationsByType

func (s *UnaryExpr) FindDeclarationsByType(nodeType NodeType) []*Ident

FindDeclarationsByType finds all declarations by (parent) type

func (*UnaryExpr) FindFirstByName

func (s *UnaryExpr) FindFirstByName(name string) Node

FindFirstByName looks for a name in the entire sub tree. First node is returned if there are multiple.

func (*UnaryExpr) FindFirstByNodeType

func (s *UnaryExpr) FindFirstByNodeType(nodeType NodeType) Node

FindFirstByNodeType returns the first sub node of a certain type

func (*UnaryExpr) FindFirstIdentByName

func (s *UnaryExpr) FindFirstIdentByName(name string) *Ident

FindFirstIdentByName looks for the first Ident node in subtree with given name

func (*UnaryExpr) FindFirstUsage

func (s *UnaryExpr) FindFirstUsage(declaration *Ident) *Ident

FindFirstUsage selects the first usage

func (*UnaryExpr) FindIdentByName

func (s *UnaryExpr) FindIdentByName(name string) []*Ident

FindIdentByName looks for Ident nodes in the entire sub tree with given name

func (*UnaryExpr) FindMaps

func (s *UnaryExpr) FindMaps() []Node

FindMaps find all nodes with given value type

func (*UnaryExpr) FindNameInCallTree

func (s *UnaryExpr) FindNameInCallTree(name string) []Node

FindNameInCallTree returns all nodes in call tree with given name

func (*UnaryExpr) FindNodeTypeInCallTree

func (s *UnaryExpr) FindNodeTypeInCallTree(nodeType NodeType) []Node

FindNodeTypeInCallTree returns all nodes in call tree of a certain type

func (*UnaryExpr) FindUsages

func (s *UnaryExpr) FindUsages(declaration *Ident) []*Ident

FindUsages finds usages of given declaration

func (*UnaryExpr) FindVarDeclarations

func (s *UnaryExpr) FindVarDeclarations() []*Ident

FindVarDeclarations finds all assignStmt (:=), valueSpec (var, const) declarations

func (*UnaryExpr) GetScope

func (s *UnaryExpr) GetScope() (Node, *types.Scope)

GetScope returns the scope of the node

func (*UnaryExpr) GetSource

func (s *UnaryExpr) GetSource() []byte

GetSource returns the source code of the current node

func (*UnaryExpr) GetSourceString

func (s *UnaryExpr) GetSourceString() string

GetSourceString is a convenience function to GetSource as string

func (*UnaryExpr) Info

func (s *UnaryExpr) Info() *types.Info

Info returns the types.info node.

func (*UnaryExpr) IsContainedByType

func (s *UnaryExpr) IsContainedByType(nodeType NodeType) bool

IsContainedByType checks if node is contained by a node of given node type

func (*UnaryExpr) IsNodeType

func (s *UnaryExpr) IsNodeType(nodeType NodeType) bool

IsNodeType checks if node is of given node type

func (*UnaryExpr) IsValueType

func (s *UnaryExpr) IsValueType(valType string) bool

IsValueType checks if value type is of given type

func (*UnaryExpr) Level

func (s *UnaryExpr) Level() int

Level returns the level counted from instantiated node = 0

func (*UnaryExpr) Match

func (s *UnaryExpr) Match(regex regexp.Regexp) bool

Match matches the source code of current node and content with given regex

func (*UnaryExpr) NextParentByType

func (s *UnaryExpr) NextParentByType(nodeType NodeType) Node

NextParentByType returns the next parent of given type

func (*UnaryExpr) NodeType

func (s *UnaryExpr) NodeType() NodeType

NodeType returns the NodeType of the node

func (*UnaryExpr) Object

func (s *UnaryExpr) Object() types.Object

Object returns the object of an identifier, nil otherwise

func (*UnaryExpr) Parent

func (s *UnaryExpr) Parent() Node

Parent return the parent node

func (*UnaryExpr) Parents

func (s *UnaryExpr) Parents() []Node

Parents returns the parent path of nodes

func (*UnaryExpr) Pkg

func (s *UnaryExpr) Pkg() *Package

Pkg returns the package this node belongs to.

func (*UnaryExpr) Siblings

func (s *UnaryExpr) Siblings() []Node

Siblings returns all sibling nodes

func (*UnaryExpr) Token

func (s *UnaryExpr) Token() token.Token

Token returns the token of the node

func (*UnaryExpr) TreeNode

func (s *UnaryExpr) TreeNode(cond func(n Node) bool) Node

TreeNode walks the child tree returning the first node that meets the condition

func (*UnaryExpr) TreeNodes

func (s *UnaryExpr) TreeNodes(cond func(n Node) bool) []Node

TreeNodes walks the child tree collecting all nodes that meet the condition

func (*UnaryExpr) ValueType

func (s *UnaryExpr) ValueType() types.Type

ValueType returns value type information of an expression, nil otherwise

func (*UnaryExpr) Visit

func (s *UnaryExpr) Visit(node ast.Node) ast.Visitor

Visit implements the ast.Visitor interface and is used to walk the underlying ast.Node tree

func (*UnaryExpr) Walk

func (s *UnaryExpr) Walk(f func(node Node) bool)

Walk traverses the tree and its children. return false to skip children of the current element

type ValueSpec

type ValueSpec struct {
	*ast.ValueSpec
	// contains filtered or unexported fields
}

ValueSpec wraps ast.ValueSpec

func (*ValueSpec) AstNode

func (s *ValueSpec) AstNode() ast.Node

AstNode returns the original ast.Node

func (ValueSpec) CallTreeNode

func (s ValueSpec) CallTreeNode(cond func(n Node) bool) Node

CallTreeNode walks the call tree returning the first node that meets the condition

func (ValueSpec) CallTreeNodes

func (s ValueSpec) CallTreeNodes(cond func(n Node) bool) []Node

CallTreeNodes walks the call tree collecting all nodes that meet the condition

func (*ValueSpec) ChildByName

func (s *ValueSpec) ChildByName(name string) Node

ChildByName retrieves a node among the direkt children by name (only nodes that have a name)

func (*ValueSpec) ChildByNodeType

func (s *ValueSpec) ChildByNodeType(nodeType NodeType) Node

ChildByNodeType returns the first child of a certain type.

func (*ValueSpec) ChildNode

func (s *ValueSpec) ChildNode(cond func(n Node) bool) Node

ChildNode walks only child nodes returning the first node that meets the condition

func (*ValueSpec) ChildNodes

func (s *ValueSpec) ChildNodes(cond func(n Node) bool) []Node

ChildNodes walks only child nodes collecting all nodes that meet the condition

func (*ValueSpec) Children

func (s *ValueSpec) Children() []Node

Children returns all child nodes

func (*ValueSpec) ChildrenByNodeType

func (s *ValueSpec) ChildrenByNodeType(nodeType NodeType) []Node

ChildrenByNodeType returns the first child of a certain type.

func (*ValueSpec) Contains

func (s *ValueSpec) Contains(node Node) bool

Contains checks if a node contains another node

func (*ValueSpec) FindByName

func (s *ValueSpec) FindByName(name string) []Node

FindByName looks for a name in the entire sub tree

func (*ValueSpec) FindByNodeType

func (s *ValueSpec) FindByNodeType(nodeType NodeType) []Node

FindByNodeType returns all sub nodes of a certain type

func (*ValueSpec) FindByToken

func (s *ValueSpec) FindByToken(t token.Token) []Node

FindByToken finds a node with a token.Token attached and of given token type

func (*ValueSpec) FindByValueType

func (s *ValueSpec) FindByValueType(valType string) []Node

FindByValueType find all nodes with given value type

func (*ValueSpec) FindDeclarations

func (s *ValueSpec) FindDeclarations() []*Ident

FindDeclarations finds all declarations

func (*ValueSpec) FindDeclarationsByType

func (s *ValueSpec) FindDeclarationsByType(nodeType NodeType) []*Ident

FindDeclarationsByType finds all declarations by (parent) type

func (*ValueSpec) FindFirstByName

func (s *ValueSpec) FindFirstByName(name string) Node

FindFirstByName looks for a name in the entire sub tree. First node is returned if there are multiple.

func (*ValueSpec) FindFirstByNodeType

func (s *ValueSpec) FindFirstByNodeType(nodeType NodeType) Node

FindFirstByNodeType returns the first sub node of a certain type

func (*ValueSpec) FindFirstIdentByName

func (s *ValueSpec) FindFirstIdentByName(name string) *Ident

FindFirstIdentByName looks for the first Ident node in subtree with given name

func (*ValueSpec) FindFirstUsage

func (s *ValueSpec) FindFirstUsage(declaration *Ident) *Ident

FindFirstUsage selects the first usage

func (*ValueSpec) FindIdentByName

func (s *ValueSpec) FindIdentByName(name string) []*Ident

FindIdentByName looks for Ident nodes in the entire sub tree with given name

func (*ValueSpec) FindMaps

func (s *ValueSpec) FindMaps() []Node

FindMaps find all nodes with given value type

func (*ValueSpec) FindNameInCallTree

func (s *ValueSpec) FindNameInCallTree(name string) []Node

FindNameInCallTree returns all nodes in call tree with given name

func (*ValueSpec) FindNodeTypeInCallTree

func (s *ValueSpec) FindNodeTypeInCallTree(nodeType NodeType) []Node

FindNodeTypeInCallTree returns all nodes in call tree of a certain type

func (*ValueSpec) FindUsages

func (s *ValueSpec) FindUsages(declaration *Ident) []*Ident

FindUsages finds usages of given declaration

func (*ValueSpec) FindVarDeclarations

func (s *ValueSpec) FindVarDeclarations() []*Ident

FindVarDeclarations finds all assignStmt (:=), valueSpec (var, const) declarations

func (*ValueSpec) GetScope

func (s *ValueSpec) GetScope() (Node, *types.Scope)

GetScope returns the scope of the node

func (*ValueSpec) GetSource

func (s *ValueSpec) GetSource() []byte

GetSource returns the source code of the current node

func (*ValueSpec) GetSourceString

func (s *ValueSpec) GetSourceString() string

GetSourceString is a convenience function to GetSource as string

func (*ValueSpec) Info

func (s *ValueSpec) Info() *types.Info

Info returns the types.info node.

func (*ValueSpec) IsContainedByType

func (s *ValueSpec) IsContainedByType(nodeType NodeType) bool

IsContainedByType checks if node is contained by a node of given node type

func (*ValueSpec) IsNodeType

func (s *ValueSpec) IsNodeType(nodeType NodeType) bool

IsNodeType checks if node is of given node type

func (*ValueSpec) IsValueType

func (s *ValueSpec) IsValueType(valType string) bool

IsValueType checks if value type is of given type

func (*ValueSpec) Level

func (s *ValueSpec) Level() int

Level returns the level counted from instantiated node = 0

func (*ValueSpec) Match

func (s *ValueSpec) Match(regex regexp.Regexp) bool

Match matches the source code of current node and content with given regex

func (*ValueSpec) NextParentByType

func (s *ValueSpec) NextParentByType(nodeType NodeType) Node

NextParentByType returns the next parent of given type

func (*ValueSpec) NodeType

func (s *ValueSpec) NodeType() NodeType

NodeType returns the NodeType of the node

func (*ValueSpec) Object

func (s *ValueSpec) Object() types.Object

Object returns the object of an identifier, nil otherwise

func (*ValueSpec) Parent

func (s *ValueSpec) Parent() Node

Parent return the parent node

func (*ValueSpec) Parents

func (s *ValueSpec) Parents() []Node

Parents returns the parent path of nodes

func (*ValueSpec) Pkg

func (s *ValueSpec) Pkg() *Package

Pkg returns the package this node belongs to.

func (*ValueSpec) Siblings

func (s *ValueSpec) Siblings() []Node

Siblings returns all sibling nodes

func (*ValueSpec) TreeNode

func (s *ValueSpec) TreeNode(cond func(n Node) bool) Node

TreeNode walks the child tree returning the first node that meets the condition

func (*ValueSpec) TreeNodes

func (s *ValueSpec) TreeNodes(cond func(n Node) bool) []Node

TreeNodes walks the child tree collecting all nodes that meet the condition

func (*ValueSpec) ValueType

func (s *ValueSpec) ValueType() types.Type

ValueType returns the value type of the node.

func (*ValueSpec) Visit

func (s *ValueSpec) Visit(node ast.Node) ast.Visitor

Visit implements the ast.Visitor interface and is used to walk the underlying ast.Node tree

func (*ValueSpec) Walk

func (s *ValueSpec) Walk(f func(node Node) bool)

Walk traverses the tree and its children. return false to skip children of the current element

type ValueTyper

type ValueTyper interface {
	ValueType() types.Type
}

ValueTyper provides an interface for nodes with a value type.

Directories

Path Synopsis
1
2
3
4
5
Package diffsquares provides method for square diffs.
Package diffsquares provides method for square diffs.
6
7
Package hamming contains function to calculate amount of character difference between two equal strings.
Package hamming contains function to calculate amount of character difference between two equal strings.
8

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL