Skip to content

Commit 0d1e3ce

Browse files
[jssrc2cpg] Fix TS declare function handling (#5696)
Method node generated for this construct were added twice into the AST.
1 parent 3e632fe commit 0d1e3ce

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

joern-cli/frontends/jssrc2cpg/src/main/scala/io/joern/jssrc2cpg/astcreation/AstForFunctionsCreator.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ trait AstForFunctionsCreator(implicit withSchemaValidation: ValidationMode) { th
328328
.possibleTypes(possibleTypes)
329329
diffGraph.addEdge(getParentTypeDecl, memberNode_, EdgeTypes.AST)
330330
addModifier(functionNode, func.json)
331-
Ast(functionNode)
331+
Ast()
332332
}
333333

334334
protected def createMethodDefinitionNode(

joern-cli/frontends/jssrc2cpg/src/test/scala/io/joern/jssrc2cpg/passes/ast/TsAstCreationPassTests.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ class TsAstCreationPassTests extends AstJsSrc2CpgSuite(".ts") {
109109
arg.code shouldBe "arg: string"
110110
arg.index shouldBe 1
111111
cpg.method("foo").bindingTypeDecl.fullName.l shouldBe List("Test0.ts::program:foo")
112+
func.astIn.size shouldBe 1
112113
}
113114

114115
"have correct structure for type assertion" in {

0 commit comments

Comments
 (0)