Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[c#] Type Node Pass #4401

Merged
merged 2 commits into from
Mar 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import io.joern.x2cpg.X2Cpg.withNewEmptyCpg
import io.joern.x2cpg.astgen.AstGenRunner.AstGenRunnerResult
import io.joern.x2cpg.astgen.ParserResult
import io.joern.x2cpg.passes.callgraph.NaiveCallLinker
import io.joern.x2cpg.passes.frontend.MetaDataPass
import io.joern.x2cpg.passes.frontend.{MetaDataPass, TypeNodePass}
import io.joern.x2cpg.utils.{ConcurrentTaskUtil, Environment, HashUtil, Report}
import io.joern.x2cpg.{SourceFiles, X2CpgFrontend}
import io.shiftleft.codepropertygraph.Cpg
Expand Down Expand Up @@ -56,6 +56,7 @@ class CSharpSrc2Cpg extends X2CpgFrontend[Config] {
internalProgramSummary
}
new AstCreationPass(cpg, astCreators.map(_.withSummary(programSummary)), report).createAndApply()
TypeNodePass.withTypesFromCpg(cpg).createAndApply()
report.print()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class NamespaceTests extends CSharpCode2CpgFixture {

"assign appropriate AST parent for both classes" in {
val List(fooNamespace) = cpg.namespaceBlock.nameExact("Foo").l
val List(bar, baz) = cpg.typeDecl.l
val List(bar, baz) = cpg.typeDecl.name("Ba.*").l
bar.astParent shouldBe fooNamespace
baz.astParent shouldBe fooNamespace

Expand Down