Documentation
¶
Overview ¶
Code generated by the `ir/codegen` package. DO NOT EDIT.
Code generated by the `ir/codegen` package. DO NOT EDIT.
Index ¶
- func FindClassMethodNode(n ir.Node, name string) *ir.ClassMethodStmt
- func FindPHPDoc(n ir.Node, withSuspicious bool) (doc string, found bool)
- func FindWithPredicate(what ir.Node, where ir.Node, pred findPredicate) bool
- func FmtNode(n ir.Node) string
- func InLoop(path NodePath) bool
- func Inspect(root ir.Node, visit func(ir.Node) bool)
- func IsAssign(n ir.Node) bool
- func IsBoolAnd(n ir.Node) bool
- func IsBoolOr(n ir.Node) bool
- func IsLoop(n ir.Node) bool
- func Keywords(n ir.Node) []*token.Token
- func NodeClone(x ir.Node) ir.Node
- func NodeEqual(x, y ir.Node) bool
- func NodeSliceClone(xs []ir.Node) []ir.Node
- func NodeSliceEqual(xs, ys []ir.Node) bool
- func Unparen(e ir.Node) ir.Node
- type NodePath
- type NodeSet
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FindClassMethodNode ¶ added in v0.4.0
func FindClassMethodNode(n ir.Node, name string) *ir.ClassMethodStmt
func FindPHPDoc ¶ added in v0.5.0
FindPHPDoc searches for phpdoc by traversing all subtree and all tokens.
func FindWithPredicate ¶ added in v0.4.0
FindWithPredicate searches for a node in the passed subtree using a predicate.
If the predicate returns true, the search ends.
func Keywords ¶ added in v0.4.0
Keywords returns one or two tokens that contain the keywords for the passed node.
func NodeSliceEqual ¶
Types ¶
type NodePath ¶ added in v0.4.0
type NodePath struct {
// contains filtered or unexported fields
}
func NewNodePath ¶ added in v0.4.0
func NewNodePath() NodePath
func (NodePath) Conditional ¶ added in v0.4.0
func (NodePath) ConditionalUntil ¶ added in v0.4.0
type NodeSet ¶
type NodeSet struct {
// contains filtered or unexported fields
}
NodeSet is a set of unique AST nodes.
It's possible to avoid allocations in most cases if node set is reused with Reset(). If this is not possible, use NewNodeSet() to create a set that can do fewer allocations than a zero value set.
NodeSet is not thread-safe, but since Root/Block walkers always operate in isolation, we can share on per RootWalker level.
func NewNodeSet ¶
func NewNodeSet() NodeSet
NewNodeSet returns a node set with preallocated storage.
Intended to be used in places where reusing root node set is tricky or impossible (function is reentrant).
func (*NodeSet) Add ¶
Add attempts to insert x into the node set.
Returns true if element was inserted. If x is already in the set, false is returned and no insertion is performed.