Skip to content

Commit 7767514

Browse files
authored
rubysrc2cpg: refactor to use x2cpg's DynamicCallUnknownName (#2811)
1 parent daa68e3 commit 7767514

File tree

1 file changed

+6
-7
lines changed
  • joern-cli/frontends/rubysrc2cpg/src/main/scala/io/joern/rubysrc2cpg/astcreation

1 file changed

+6
-7
lines changed

joern-cli/frontends/rubysrc2cpg/src/main/scala/io/joern/rubysrc2cpg/astcreation/AstCreator.scala

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import io.joern.rubysrc2cpg.parser.RubyParser._
33
import io.joern.rubysrc2cpg.parser.{RubyLexer, RubyParser}
44
import io.joern.x2cpg.Ast.storeInDiffGraph
55
import io.joern.x2cpg.datastructures.Global
6+
import io.joern.x2cpg.Defines.DynamicCallUnknownFullName
67
import io.joern.x2cpg.{Ast, AstCreatorBase, AstNodeBuilder}
78
import io.shiftleft.codepropertygraph.generated.{
89
ControlStructureTypes,
@@ -20,7 +21,6 @@ import overflowdb.BatchedUpdate
2021
import java.util
2122
import scala.collection.mutable
2223
import scala.collection.mutable.ListBuffer
23-
import scala.io.Source
2424
import scala.jdk.CollectionConverters._
2525

2626
class AstCreator(filename: String, global: Global)
@@ -41,8 +41,7 @@ class AstCreator(filename: String, global: Global)
4141
}
4242

4343
object MethodFullNames {
44-
val UnknownFullName = "<unknownfullname>"
45-
val OperatorPrefix = "<operator>."
44+
val OperatorPrefix = "<operator>."
4645
}
4746

4847
private val logger = LoggerFactory.getLogger(this.getClass)
@@ -569,7 +568,7 @@ class AstCreator(filename: String, global: Global)
569568
.name(Operators.arrayInitializer)
570569
.methodFullName(Operators.arrayInitializer)
571570
.signature(Operators.arrayInitializer)
572-
.typeFullName(MethodFullNames.UnknownFullName)
571+
.typeFullName(DynamicCallUnknownFullName)
573572
.dispatchType(DispatchTypes.STATIC_DISPATCH)
574573
.code(ctx.getText)
575574
Seq(callAst(callNode, expAsts))
@@ -587,7 +586,7 @@ class AstCreator(filename: String, global: Global)
587586
.name(ctx.COMMA().getText)
588587
.methodFullName(Operators.arrayInitializer)
589588
.signature(Operators.arrayInitializer)
590-
.typeFullName(MethodFullNames.UnknownFullName)
589+
.typeFullName(DynamicCallUnknownFullName)
591590
.dispatchType(DispatchTypes.STATIC_DISPATCH)
592591
.code(ctx.getText)
593592
.lineNumber(ctx.COMMA().getSymbol.getLine)
@@ -1200,7 +1199,7 @@ class AstCreator(filename: String, global: Global)
12001199
.name(name)
12011200
.methodFullName(methodFullName)
12021201
.signature(localIdentifier.getText())
1203-
.typeFullName(MethodFullNames.UnknownFullName)
1202+
.typeFullName(DynamicCallUnknownFullName)
12041203
.dispatchType(DispatchTypes.STATIC_DISPATCH)
12051204
.code(localIdentifier.getText())
12061205
.lineNumber(line)
@@ -1940,7 +1939,7 @@ class AstCreator(filename: String, global: Global)
19401939
val callNode = NewCall()
19411940
.name(getActualMethodName(methodCallNode.name))
19421941
.code(ctx.getText)
1943-
.methodFullName(MethodFullNames.UnknownFullName)
1942+
.methodFullName(DynamicCallUnknownFullName)
19441943
.signature("")
19451944
.dispatchType(DispatchTypes.STATIC_DISPATCH)
19461945
.typeFullName(Defines.Any)

0 commit comments

Comments
 (0)