From 9a04917757a245fe422cf0b17c780933c134e085 Mon Sep 17 00:00:00 2001 From: Reuben Steenekamp Date: Fri, 10 Nov 2023 14:46:03 +0200 Subject: [PATCH] s/BodyStatementsInfo/BodyControlInfo/ --- .../astcreation/declarations/AstForMethodsCreator.scala | 6 +++--- .../astcreation/statements/AstForStatementsCreator.scala | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/joern-cli/frontends/jimple2cpg/src/main/scala/io/joern/jimple2cpg/astcreation/declarations/AstForMethodsCreator.scala b/joern-cli/frontends/jimple2cpg/src/main/scala/io/joern/jimple2cpg/astcreation/declarations/AstForMethodsCreator.scala index 819c1ce9d978..fbc10a25a21e 100644 --- a/joern-cli/frontends/jimple2cpg/src/main/scala/io/joern/jimple2cpg/astcreation/declarations/AstForMethodsCreator.scala +++ b/joern-cli/frontends/jimple2cpg/src/main/scala/io/joern/jimple2cpg/astcreation/declarations/AstForMethodsCreator.scala @@ -19,7 +19,7 @@ import scala.util.{Failure, Success, Try} import cats.syntax.all.*; import scala.collection.mutable.ArrayBuffer -import io.joern.jimple2cpg.astcreation.statements.BodyStatementsInfo +import io.joern.jimple2cpg.astcreation.statements.BodyControlInfo trait AstForMethodsCreator(implicit withSchemaValidation: ValidationMode) { this: AstCreator => @@ -29,7 +29,7 @@ trait AstForMethodsCreator(implicit withSchemaValidation: ValidationMode) { this private val JVM_LANGS = HashSet("scala", "clojure", "groovy", "kotlin", "jython", "jruby") protected def astForMethod(methodDeclaration: SootMethod, typeDecl: RefType): Ast = { - val bodyStatementsInfo = BodyStatementsInfo() + val bodyStatementsInfo = BodyControlInfo() val methodNode = createMethodNode(methodDeclaration, typeDecl) try { if (!methodDeclaration.isConcrete) { @@ -207,7 +207,7 @@ trait AstForMethodsCreator(implicit withSchemaValidation: ValidationMode) { this } } - private def astForMethodBody(body: Body, info: BodyStatementsInfo): Ast = { + private def astForMethodBody(body: Body, info: BodyControlInfo): Ast = { val jimpleParams = body.getParameterLocals.asScala.toList // Don't let parameters also become locals (avoiding duplication) val jimpleLocals = body.getLocals.asScala.filterNot(l => jimpleParams.contains(l) || l.getName == "this").toList diff --git a/joern-cli/frontends/jimple2cpg/src/main/scala/io/joern/jimple2cpg/astcreation/statements/AstForStatementsCreator.scala b/joern-cli/frontends/jimple2cpg/src/main/scala/io/joern/jimple2cpg/astcreation/statements/AstForStatementsCreator.scala index 171ef0a2bfc3..cbdad1fe6bc6 100644 --- a/joern-cli/frontends/jimple2cpg/src/main/scala/io/joern/jimple2cpg/astcreation/statements/AstForStatementsCreator.scala +++ b/joern-cli/frontends/jimple2cpg/src/main/scala/io/joern/jimple2cpg/astcreation/statements/AstForStatementsCreator.scala @@ -17,7 +17,7 @@ trait AstForStatementsCreator(implicit withSchemaValidation: ValidationMode) { t private val logger = LoggerFactory.getLogger(getClass) - protected def astsForStatement(statement: soot.Unit, info: BodyStatementsInfo): Seq[Ast] = { + protected def astsForStatement(statement: soot.Unit, info: BodyControlInfo): Seq[Ast] = { val stmt = statement match { case x: AssignStmt => astsForDefinition(x) case x: InvokeStmt => astsForExpression(x.getInvokeExpr, statement) @@ -203,14 +203,14 @@ trait AstForStatementsCreator(implicit withSchemaValidation: ValidationMode) { t ) } - private def astsForIfStmt(ifStmt: IfStmt, info: BodyStatementsInfo): Seq[Ast] = { + private def astsForIfStmt(ifStmt: IfStmt, info: BodyControlInfo): Seq[Ast] = { // bytecode/jimple ASTs are flat so there will not be nested bodies val condition = astsForValue(ifStmt.getCondition, ifStmt) info.targets.put(condition, ifStmt.getTarget) condition } - private def astsForGotoStmt(gotoStmt: GotoStmt, info: BodyStatementsInfo): Seq[Ast] = { + private def astsForGotoStmt(gotoStmt: GotoStmt, info: BodyControlInfo): Seq[Ast] = { // bytecode/jimple ASTs are flat so there will not be nested bodies val gotoAst = Seq( Ast( @@ -249,7 +249,7 @@ trait AstForStatementsCreator(implicit withSchemaValidation: ValidationMode) { t } -class BodyStatementsInfo( +class BodyControlInfo( val unitToAsts: mutable.HashMap[soot.Unit, Seq[Ast]] = mutable.HashMap.empty, val targets: mutable.HashMap[Seq[Ast], soot.Unit] = mutable.HashMap.empty, val edges: ArrayBuffer[(soot.Unit, soot.Unit)] = mutable.ArrayBuffer.empty