AstNodeTraversal

@Traversal(elementType = scala.Predef.classOf[io.shiftleft.codepropertygraph.generated.nodes.AstNode]) final
class AstNodeTraversal[A <: AstNode](val traversal: Traversal[A]) extends AnyVal
class AnyVal
trait Matchable
class Any

Value members

Concrete methods

@Doc(info = "All nodes of the abstract syntax tree")
def ast: Traversal[AstNode]

Nodes of the AST rooted in this node, including the node itself.

Nodes of the AST rooted in this node, including the node itself.

def ast(predicate: AstNode => Boolean): Traversal[AstNode]

All nodes of the abstract syntax tree rooted in this node, which match predicate. Equivalent of match in the original CPG paper.

All nodes of the abstract syntax tree rooted in this node, which match predicate. Equivalent of match in the original CPG paper.

def astChildren: Traversal[AstNode]

Direct children of node in the AST. Siblings are ordered by their order fields

Direct children of node in the AST. Siblings are ordered by their order fields

def astMinusRoot: Traversal[AstNode]

Nodes of the AST rooted in this node, minus the node itself

Nodes of the AST rooted in this node, minus the node itself

def astParent: Traversal[AstNode]

Parent AST node

Parent AST node

def containsCallTo(regex: String): Traversal[A]
@Doc(info = "Depth of the abstract syntax tree")
def depth: Traversal[Int]
def depth(p: AstNode => Boolean): Traversal[Int]
def inAst: Traversal[AstNode]

Nodes of the AST obtained by expanding AST edges backwards until the method root is reached

Nodes of the AST obtained by expanding AST edges backwards until the method root is reached

def inAst(root: AstNode): Traversal[AstNode]

Nodes of the AST obtained by expanding AST edges backwards until root or the method root is reached

Nodes of the AST obtained by expanding AST edges backwards until root or the method root is reached

def inAstMinusLeaf: Traversal[AstNode]

Nodes of the AST obtained by expanding AST edges backwards until the method root is reached, minus this node

Nodes of the AST obtained by expanding AST edges backwards until the method root is reached, minus this node

def inAstMinusLeaf(root: AstNode): Traversal[AstNode]

Nodes of the AST obtained by expanding AST edges backwards until root or the method root is reached, minus this node

Nodes of the AST obtained by expanding AST edges backwards until root or the method root is reached, minus this node

def isBlock: Traversal[Block]

Traverse only to those AST nodes that are blocks

Traverse only to those AST nodes that are blocks

def isCall: Traversal[Call]

Traverse only to AST nodes that are calls

Traverse only to AST nodes that are calls

def isCall(calleeRegex: String): Traversal[Call]

Cast to call if applicable and filter on call code calleeRegex

Cast to call if applicable and filter on call code calleeRegex

def isCallTo(regex: String): Traversal[Call]
def isCfgNode: Traversal[CfgNode]

Traverse only to those AST nodes that are also control flow graph nodes

Traverse only to those AST nodes that are also control flow graph nodes

def isControlStructure: Traversal[ControlStructure]

Traverse only to those AST nodes that are control structures

Traverse only to those AST nodes that are control structures

def isExpression: Traversal[Expression]

Traverse only to AST nodes that are expressions

Traverse only to AST nodes that are expressions

def isFieldIdentifier: Traversal[FieldIdentifier]

Traverse only to AST nodes that are field identifier

Traverse only to AST nodes that are field identifier

def isFile: Traversal[File]

Traverse only to FILE AST nodes

Traverse only to FILE AST nodes

def isIdentifier: Traversal[Identifier]

Traverse only to AST nodes that are identifier

Traverse only to AST nodes that are identifier

def isLiteral: Traversal[Literal]

Traverse only to AST nodes that are literals

Traverse only to AST nodes that are literals

def isLocal: Traversal[Local]
def isMember: Traversal[Member]

Traverse only to AST nodes that are MEMBER

Traverse only to AST nodes that are MEMBER

def isMethod: Traversal[Method]

Traverse only to AST nodes that are METHOD

Traverse only to AST nodes that are METHOD

def isMethodRef: Traversal[MethodRef]

Traverse only to AST nodes that are method reference

Traverse only to AST nodes that are method reference

def isModifier: Traversal[Modifier]

Traverse only to AST nodes that are MODIFIER

Traverse only to AST nodes that are MODIFIER

def isNamespaceBlock: Traversal[NamespaceBlock]

Traverse only to AST nodes that are NAMESPACE_BLOCK

Traverse only to AST nodes that are NAMESPACE_BLOCK

def isParameter: Traversal[MethodParameterIn]

Traverse only to AST nodes that are METHOD_PARAMETER_IN

Traverse only to AST nodes that are METHOD_PARAMETER_IN

def isReturn: Traversal[Return]

Traverse only to AST nodes that are return nodes

Traverse only to AST nodes that are return nodes

def isTypeDecl: Traversal[TypeDecl]

Traverse only to AST nodes that are TYPE_DECL

Traverse only to AST nodes that are TYPE_DECL

def isTypeRef: Traversal[MethodRef]

Traverse only to AST nodes that are type reference

Traverse only to AST nodes that are type reference

def walkAstUntilReaching(labels: List[String]): Traversal[StoredNode]

Concrete fields

val traversal: Traversal[A]