AstCreator

class AstCreator(filename: String, typeInfoProvider: TypeInfoProvider)
Companion:
object
class Object
trait Matchable
class Any

Value members

Concrete methods

def astForArrayAccessExpr(expr: ArrayAccessExpr, scopeContext: ScopeContext, order: Int): AstWithCtx
def astForArrayCreationExpr(expr: ArrayCreationExpr, scopeContext: ScopeContext, order: Int): AstWithCtx
def astForArrayInitializerExpr(expr: ArrayInitializerExpr, scopeContext: ScopeContext, order: Int): AstWithCtx
def astForBinaryExpr(expr: BinaryExpr, scopeContext: ScopeContext, order: Int): AstWithCtx
def astForBreakStatement(stmt: BreakStmt, order: Int): AstWithCtx
def astForCastExpr(expr: CastExpr, scopeContext: ScopeContext, order: Int): AstWithCtx
def astForCatchClause(catchClause: CatchClause, scopeContext: ScopeContext, order: Int): AstWithCtx
def astForClassExpr(expr: ClassExpr, scopeContext: ScopeContext, order: Int): AstWithCtx
def astForConditionalExpr(expr: ConditionalExpr, scopeContext: ScopeContext, order: Int): AstWithCtx
def astForContinueStatement(stmt: ContinueStmt, order: Int): AstWithCtx
def astForDo(stmt: DoStmt, scopeContext: ScopeContext, order: Int): AstWithCtx
def astForEnclosedExpression(expr: EnclosedExpr, scopeContext: ScopeContext, order: Int): Seq[AstWithCtx]
def astForFieldAccessExpr(expr: FieldAccessExpr, scopeContext: ScopeContext, order: Int): AstWithCtx
def astForFor(stmt: ForStmt, scopeContext: ScopeContext, order: Int): AstWithCtx
def astForForEach(stmt: ForEachStmt, scopeContext: ScopeContext, order: Int): AstWithCtx
def astForIf(stmt: IfStmt, scopeContext: ScopeContext, order: Int): AstWithCtx
def astForInstanceOfExpr(expr: InstanceOfExpr, scopeContext: ScopeContext, order: Int): AstWithCtx
def astForNameExpr(x: NameExpr, scopeContext: ScopeContext, order: Int): AstWithCtx
def astForObjectCreationExpr(expr: ObjectCreationExpr, scopeContext: ScopeContext, order: Int): AstWithCtx

The below representation for constructor invocations and object creations was chosen for the sake of consistency with the Java frontend. It follows the bytecode approach of splitting a constructor call into separate alloc and init calls.

The below representation for constructor invocations and object creations was chosen for the sake of consistency with the Java frontend. It follows the bytecode approach of splitting a constructor call into separate alloc and init calls.

There are two cases to consider. The first is a constructor invocation in an assignment, for example:

Foo f = new Foo(42);

is represented as

Foo f = .alloc() f.init(42);

The second case is a constructor invocation not in an assignment, for example as an argument to a method call. In this case, the representation does not stay as close to Java as in case

  1. In particular, a new BLOCK is introduced to contain the constructor invocation. For example:

foo(new Foo(42));

is represented as

foo({ Foo temp = alloc(); temp.init(42); temp })

This is not valid Java code, but this representation is a decent compromise between staying faithful to Java and being consistent with the Java bytecode frontend.

def astForSwitchEntry(entry: SwitchEntry, scopeContext: ScopeContext, order: Int): Seq[AstWithCtx]
def astForSwitchStatement(stmt: SwitchStmt, scopeContext: ScopeContext, order: Int): AstWithCtx
def astForThisExpr(expr: ThisExpr, order: Int): AstWithCtx
def astForThrow(stmt: ThrowStmt, scopeContext: ScopeContext, order: Int): AstWithCtx
def astForTry(stmt: TryStmt, scopeContext: ScopeContext, order: Int): AstWithCtx
def astForUnaryExpr(stmt: UnaryExpr, scopeContext: ScopeContext, order: Int): AstWithCtx
def astForWhile(stmt: WhileStmt, scopeContext: ScopeContext, order: Int): AstWithCtx
def astsForAssignExpr(expr: AssignExpr, scopeContext: ScopeContext, order: Int): Seq[AstWithCtx]
def astsForLabeledStatement(stmt: LabeledStmt, scopeContext: ScopeContext, order: Int): Seq[AstWithCtx]
def astsForVariableDecl(varDecl: VariableDeclarationExpr, scopeContext: ScopeContext, order: Int): Seq[AstWithCtx]
def callAst(rootNode: NewNode, args: Seq[AstWithCtx]): AstWithCtx
def createAst(parserResult: CompilationUnit): DiffGraphBuilder

Entry point of AST creation. Translates a compilation unit created by JavaParser into a DiffGraph containing the corresponding CPG AST.

Entry point of AST creation. Translates a compilation unit created by JavaParser into a DiffGraph containing the corresponding CPG AST.

Concrete fields

val diffGraph: DiffGraphBuilder
var lambdaCounter: Int
val stack: Stack[NewNode]