diff --git a/joern-cli/frontends/csharpsrc2cpg/src/main/scala/io/joern/csharpsrc2cpg/astcreation/AstCreator.scala b/joern-cli/frontends/csharpsrc2cpg/src/main/scala/io/joern/csharpsrc2cpg/astcreation/AstCreator.scala index 699d40cb9202..a415ba1d2599 100644 --- a/joern-cli/frontends/csharpsrc2cpg/src/main/scala/io/joern/csharpsrc2cpg/astcreation/AstCreator.scala +++ b/joern-cli/frontends/csharpsrc2cpg/src/main/scala/io/joern/csharpsrc2cpg/astcreation/AstCreator.scala @@ -58,10 +58,10 @@ class AstCreator(val relativeFileName: String, val parserResult: ParserResult, v Option(NodeTypes.TYPE_DECL), Some("") // TODO: Find fullyQualifiedPackage and assign to astParent ) - methodAstParentStack.push(fakeGlobalMethodForFile) +// methodAstParentStack.push(fakeGlobalMethodForFile) // TODO: Confirm if this has to be included in the methodAstParentStack as this affects fullName creation for structs scope.pushNewScope(fakeGlobalMethodForFile) val memberAsts = astForMembers(cu.json(ParserKeys.Members).arr.map(createDotNetNodeInfo).toSeq) - methodAstParentStack.pop() +// methodAstParentStack.pop() scope.popScope() memberAsts } diff --git a/joern-cli/frontends/csharpsrc2cpg/src/main/scala/io/joern/csharpsrc2cpg/astcreation/AstForDeclarationsCreator.scala b/joern-cli/frontends/csharpsrc2cpg/src/main/scala/io/joern/csharpsrc2cpg/astcreation/AstForDeclarationsCreator.scala index d46dbf15b970..523258943051 100644 --- a/joern-cli/frontends/csharpsrc2cpg/src/main/scala/io/joern/csharpsrc2cpg/astcreation/AstForDeclarationsCreator.scala +++ b/joern-cli/frontends/csharpsrc2cpg/src/main/scala/io/joern/csharpsrc2cpg/astcreation/AstForDeclarationsCreator.scala @@ -110,7 +110,6 @@ trait AstForDeclarationsCreator(implicit withSchemaValidation: ValidationMode) { .zipWithIndex .map(astForParameter) .toSeq - val body = astForMethodBody(createDotNetNodeInfo(methodDecl.json(ParserKeys.Body))) val methodReturn = nodeToMethodReturn(createDotNetNodeInfo(methodDecl.json(ParserKeys.ReturnType))) val signature = methodSignature(methodReturn, params.flatMap(_.nodes.collectFirst { case x: NewMethodParameterIn => x })) @@ -118,6 +117,7 @@ trait AstForDeclarationsCreator(implicit withSchemaValidation: ValidationMode) { val methodNode_ = methodNode(methodDecl, name, code(methodDecl), fullName, Option(signature), relativeFileName) methodAstParentStack.push(methodNode_) scope.pushNewScope(methodNode_) + val body = astForMethodBody(createDotNetNodeInfo(methodDecl.json(ParserKeys.Body))) val modifiers = astForModifiers(methodDecl).flatMap(_.nodes).collect { case x: NewModifier => x } val thisNode = if (!modifiers.exists(_.modifierType == ModifierTypes.STATIC)) astForThisNode(methodDecl)