MethodTraversal

@Traversal(elementType = scala.Predef.classOf[io.shiftleft.codepropertygraph.generated.nodes.Method])
final class MethodTraversal(val iterableOnce: IterableOnce[Method]) extends AnyVal

A method, function, or procedure

class AnyVal
trait Matchable
class Any

Value members

Concrete methods

def annotation: Traversal[Annotation]

Traverse to annotations of method

Traverse to annotations of method

@Doc(info = "Alias for `block`")
def body: Traversal[Block]

Traverse to method body (alias for block)

Traverse to method body (alias for block)

@Doc(info = "All breaks (`ControlStructure` nodes)")
def break: Traversal[ControlStructure]
@Doc(info = "Last control flow graph node")
def cfgLast: Traversal[CfgNode]

Traverse to last expression in CFG.

Traverse to last expression in CFG.

@Doc(info = "Control flow graph nodes")
def cfgNode: Traversal[CfgNode]
@Doc(info = "All continues (`ControlStructure` nodes)")
def continue: Traversal[ControlStructure]
@Doc(info = "Control structures (source frontends only)")
def controlStructure: Traversal[ControlStructure]

All control structures of this method

All control structures of this method

def controlStructure(regex: String): Traversal[ControlStructure]

Shorthand to traverse to control structures where condition matches regex

Shorthand to traverse to control structures where condition matches regex

@Doc(info = "Method this method is defined in")
def definingMethod: Traversal[Method]

The method in which this method is defined

The method in which this method is defined

@Doc(info = "Type this method is defined in")
def definingTypeDecl: Traversal[TypeDecl]

The type declaration associated with this method, e.g., the class it is defined in.

The type declaration associated with this method, e.g., the class it is defined in.

@Doc(info = "All do blocks (`ControlStructure` nodes)")
def doBlock: Traversal[ControlStructure]
@Doc(info = "All else blocks (`ControlStructure` nodes)")
def elseBlock: Traversal[ControlStructure]
@Doc(info = "External methods (called, but no body available)")
def external: Traversal[Method]

Traverse to external methods, that is, methods not present but only referenced in the CPG.

Traverse to external methods, that is, methods not present but only referenced in the CPG.

@Doc(info = "All for blocks (`ControlStructure` nodes)")
def forBlock: Traversal[ControlStructure]
@Doc(info = "All gotos (`ControlStructure` nodes)")
def goto: Traversal[ControlStructure]
@Doc(info = "All if blocks (`ControlStructure` nodes)")
def ifBlock: Traversal[ControlStructure]
@Doc(info = "Internal methods, i.e., a body is available")
def internal: Traversal[Method]

Traverse to internal methods, that is, methods for which code is included in this CPG.

Traverse to internal methods, that is, methods for which code is included in this CPG.

def isNotStub: Traversal[Method]

Traverse only to methods that are not stubs.

Traverse only to methods that are not stubs.

def isStub: Traversal[Method]

Traverse only to methods that are stubs, e.g., their code is not available or the method body is empty.

Traverse only to methods that are stubs, e.g., their code is not available or the method body is empty.

def isVariadic: Traversal[Method]

Traverse only to methods that accept variadic arguments.

Traverse only to methods that accept variadic arguments.

@Doc(info = "Local variables declared in the method")
def local: Traversal[Local]

Traverse to the methods local variables

Traverse to the methods local variables

@Doc(info = "Namespace this method is declared in")
def namespace: Traversal[Namespace]

Traverse to namespace

Traverse to namespace

def numberOfLines: Traversal[Int]
@Doc(info = "All switch blocks (`ControlStructure` nodes)")
def switchBlock: Traversal[ControlStructure]
@Doc(info = "All throws (`ControlStructure` nodes)")
def throws: Traversal[ControlStructure]
@Doc(info = "Top level expressions (\"Statements\")")
def topLevelExpressions: Traversal[Expression]
@Doc(info = "All try blocks (`ControlStructure` nodes)")
def tryBlock: Traversal[ControlStructure]
@Doc(info = "All while blocks (`ControlStructure` nodes)")
def whileBlock: Traversal[ControlStructure]

Concrete fields

val iterableOnce: IterableOnce[Method]