AstNodeTraversal

io.shiftleft.semanticcpg.language.types.expressions.generalizations.AstNodeTraversal
final class AstNodeTraversal[A <: AstNode](val traversal: Iterator[A]) extends AnyVal

Attributes

Graph
Supertypes
class AnyVal
trait Matchable
class Any

Members list

Value members

Concrete methods

def ast: Iterator[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.

Attributes

def ast(predicate: AstNode => Boolean): Iterator[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.

Attributes

def astChildren: Iterator[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

Attributes

def astMinusRoot: Iterator[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

Attributes

def astParent: Iterator[AstNode]

Parent AST node

Parent AST node

Attributes

def astSiblings: Iterator[AstNode]

Siblings of this node in the AST, ordered by their order fields

Siblings of this node in the AST, ordered by their order fields

Attributes

def containsCallTo(regex: String): Iterator[A]
def depth: Iterator[Int]
def depth(p: AstNode => Boolean): Iterator[Int]
def inAst: Iterator[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

Attributes

def inAst(root: AstNode): Iterator[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

Attributes

def inAstMinusLeaf: Iterator[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

Attributes

def inAstMinusLeaf(root: AstNode): Iterator[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

Attributes

def isAnnotation: Iterator[Annotation]
def isAnnotationLiteral: Iterator[AnnotationLiteral]
def isArrayInitializer: Iterator[ArrayInitializer]
def isBlock: Iterator[Block]

Traverse only to those AST nodes that are blocks

Traverse only to those AST nodes that are blocks

Attributes

def isCall: Iterator[Call]

Traverse only to AST nodes that are calls

Traverse only to AST nodes that are calls

Attributes

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

Cast to call if applicable and filter on call code calleeRegex

Cast to call if applicable and filter on call code calleeRegex

Attributes

def isCallTo(regex: String): Iterator[Call]
def isCfgNode: Iterator[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

Attributes

def isControlStructure: Iterator[ControlStructure]

Traverse only to those AST nodes that are control structures

Traverse only to those AST nodes that are control structures

Attributes

def isExpression: Iterator[Expression]

Traverse only to AST nodes that are expressions

Traverse only to AST nodes that are expressions

Attributes

def isFieldIdentifier: Iterator[FieldIdentifier]

Traverse only to AST nodes that are field identifier

Traverse only to AST nodes that are field identifier

Attributes

def isFile: Iterator[File]

Traverse only to FILE AST nodes

Traverse only to FILE AST nodes

Attributes

def isIdentifier: Iterator[Identifier]

Traverse only to AST nodes that are identifier

Traverse only to AST nodes that are identifier

Attributes

def isImport: Iterator[Import]

Traverse only to AST nodes that are IMPORT nodes

Traverse only to AST nodes that are IMPORT nodes

Attributes

def isLiteral: Iterator[Literal]

Traverse only to AST nodes that are literals

Traverse only to AST nodes that are literals

Attributes

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

Traverse only to AST nodes that are MEMBER

Traverse only to AST nodes that are MEMBER

Attributes

def isMethod: Iterator[Method]

Traverse only to AST nodes that are METHOD

Traverse only to AST nodes that are METHOD

Attributes

def isMethodRef: Iterator[MethodRef]

Traverse only to AST nodes that are method reference

Traverse only to AST nodes that are method reference

Attributes

def isModifier: Iterator[Modifier]

Traverse only to AST nodes that are MODIFIER

Traverse only to AST nodes that are MODIFIER

Attributes

def isNamespaceBlock: Iterator[NamespaceBlock]

Traverse only to AST nodes that are NAMESPACE_BLOCK

Traverse only to AST nodes that are NAMESPACE_BLOCK

Attributes

def isParameter: Iterator[MethodParameterIn]

Traverse only to AST nodes that are METHOD_PARAMETER_IN

Traverse only to AST nodes that are METHOD_PARAMETER_IN

Attributes

def isReturn: Iterator[Return]

Traverse only to AST nodes that are return nodes

Traverse only to AST nodes that are return nodes

Attributes

def isTemplateDom: Iterator[TemplateDom]

Traverse only to AST nodes that are TemplateDom nodes

Traverse only to AST nodes that are TemplateDom nodes

Attributes

def isTypeDecl: Iterator[TypeDecl]

Traverse only to AST nodes that are TYPE_DECL

Traverse only to AST nodes that are TYPE_DECL

Attributes

def isTypeRef: Iterator[TypeRef]

Traverse only to AST nodes that are type reference

Traverse only to AST nodes that are type reference

Attributes

def parentBlock: Iterator[Block]

Traverses up the AST and returns the first block node.

Traverses up the AST and returns the first block node.

Attributes

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

Concrete fields

val traversal: Iterator[A]