Skip to content

Commit

Permalink
rubysrc2cpg: refactor to use x2cpg's DynamicCallUnknownName (#2811)
Browse files Browse the repository at this point in the history
  • Loading branch information
xavierpinho committed Jun 5, 2023
1 parent daa68e3 commit 7767514
Showing 1 changed file with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import io.joern.rubysrc2cpg.parser.RubyParser._
import io.joern.rubysrc2cpg.parser.{RubyLexer, RubyParser}
import io.joern.x2cpg.Ast.storeInDiffGraph
import io.joern.x2cpg.datastructures.Global
import io.joern.x2cpg.Defines.DynamicCallUnknownFullName
import io.joern.x2cpg.{Ast, AstCreatorBase, AstNodeBuilder}
import io.shiftleft.codepropertygraph.generated.{
ControlStructureTypes,
Expand All @@ -20,7 +21,6 @@ import overflowdb.BatchedUpdate
import java.util
import scala.collection.mutable
import scala.collection.mutable.ListBuffer
import scala.io.Source
import scala.jdk.CollectionConverters._

class AstCreator(filename: String, global: Global)
Expand All @@ -41,8 +41,7 @@ class AstCreator(filename: String, global: Global)
}

object MethodFullNames {
val UnknownFullName = "<unknownfullname>"
val OperatorPrefix = "<operator>."
val OperatorPrefix = "<operator>."
}

private val logger = LoggerFactory.getLogger(this.getClass)
Expand Down Expand Up @@ -569,7 +568,7 @@ class AstCreator(filename: String, global: Global)
.name(Operators.arrayInitializer)
.methodFullName(Operators.arrayInitializer)
.signature(Operators.arrayInitializer)
.typeFullName(MethodFullNames.UnknownFullName)
.typeFullName(DynamicCallUnknownFullName)
.dispatchType(DispatchTypes.STATIC_DISPATCH)
.code(ctx.getText)
Seq(callAst(callNode, expAsts))
Expand All @@ -587,7 +586,7 @@ class AstCreator(filename: String, global: Global)
.name(ctx.COMMA().getText)
.methodFullName(Operators.arrayInitializer)
.signature(Operators.arrayInitializer)
.typeFullName(MethodFullNames.UnknownFullName)
.typeFullName(DynamicCallUnknownFullName)
.dispatchType(DispatchTypes.STATIC_DISPATCH)
.code(ctx.getText)
.lineNumber(ctx.COMMA().getSymbol.getLine)
Expand Down Expand Up @@ -1200,7 +1199,7 @@ class AstCreator(filename: String, global: Global)
.name(name)
.methodFullName(methodFullName)
.signature(localIdentifier.getText())
.typeFullName(MethodFullNames.UnknownFullName)
.typeFullName(DynamicCallUnknownFullName)
.dispatchType(DispatchTypes.STATIC_DISPATCH)
.code(localIdentifier.getText())
.lineNumber(line)
Expand Down Expand Up @@ -1940,7 +1939,7 @@ class AstCreator(filename: String, global: Global)
val callNode = NewCall()
.name(getActualMethodName(methodCallNode.name))
.code(ctx.getText)
.methodFullName(MethodFullNames.UnknownFullName)
.methodFullName(DynamicCallUnknownFullName)
.signature("")
.dispatchType(DispatchTypes.STATIC_DISPATCH)
.typeFullName(Defines.Any)
Expand Down

0 comments on commit 7767514

Please sign in to comment.