Skip to content

Commit

Permalink
jssrc2cpg: added support for TypeCastExpression (#2821)
Browse files Browse the repository at this point in the history
This is for #2805
  • Loading branch information
max-leuthaeuser authored Jun 7, 2023
1 parent 46fa845 commit 30ef1b8
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
jssrc2cpg {
astgen_version: "3.0.0"
astgen_version: "3.1.0"
}
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,9 @@ class AstCreator(
case TSEnumDeclaration => astForEnum(nodeInfo)
case DeclareTypeAlias => astForTypeAlias(nodeInfo)
case TypeAlias => astForTypeAlias(nodeInfo)
case TypeCastExpression => astForCastExpression(nodeInfo)
case TSTypeAssertion => astForCastExpression(nodeInfo)
case TSTypeCastExpression => astForCastExpression(nodeInfo)
case TSTypeAliasDeclaration => astForTypeAlias(nodeInfo)
case NewExpression => astForNewExpression(nodeInfo)
case ThisExpression => astForThisExpression(nodeInfo)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import io.joern.x2cpg.datastructures.Stack._
import io.joern.x2cpg.utils.NodeBuilders.{newDependencyNode, newLocalNode}
import io.shiftleft.codepropertygraph.generated.nodes.{NewCall, NewImport}
import io.shiftleft.codepropertygraph.generated.{DispatchTypes, EdgeTypes}
import io.shiftleft.semanticcpg.language._
import ujson.Value

import scala.util.Try
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ object BabelAst {
object TypeAlias extends BabelNode
object TypeAnnotation extends FlowType
object TypeCastExpression extends BabelNode
object TSTypeCastExpression extends BabelNode
object TypeParameter extends BabelNode
object TypeParameterDeclaration extends BabelNode
object TypeParameterInstantiation extends BabelNode
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class TSTypesTest extends AbstractPassTest {
args.name shouldBe "args"
args.code shouldBe "...args"
args.isVariadic shouldBe true
args.typeFullName shouldBe s"${Defines.Any}[]"
args.typeFullName shouldBe Defines.Any
}

"have return types for arrow functions" in AstFixture("const foo = () => 42;", tsTypes = true) { cpg =>
Expand Down

0 comments on commit 30ef1b8

Please sign in to comment.