diff --git a/cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/graph/declarations/NamespaceDeclaration.kt b/cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/graph/declarations/NamespaceDeclaration.kt index 9fed1238d1..3c380e3a15 100644 --- a/cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/graph/declarations/NamespaceDeclaration.kt +++ b/cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/graph/declarations/NamespaceDeclaration.kt @@ -27,10 +27,12 @@ package de.fraunhofer.aisec.cpg.graph.declarations import de.fraunhofer.aisec.cpg.graph.AST import de.fraunhofer.aisec.cpg.graph.DeclarationHolder +import de.fraunhofer.aisec.cpg.graph.Node import de.fraunhofer.aisec.cpg.graph.StatementHolder import de.fraunhofer.aisec.cpg.graph.edge.PropertyEdge import de.fraunhofer.aisec.cpg.graph.edge.PropertyEdgeDelegate import de.fraunhofer.aisec.cpg.graph.statements.Statement +import de.fraunhofer.aisec.cpg.passes.ResolutionStartHolder import java.util.Objects import org.neo4j.ogm.annotation.Relationship @@ -45,7 +47,8 @@ import org.neo4j.ogm.annotation.Relationship * * The name property of this node need to be a FQN for property resolution. */ -class NamespaceDeclaration : Declaration(), DeclarationHolder, StatementHolder { +class NamespaceDeclaration : + Declaration(), DeclarationHolder, StatementHolder, ResolutionStartHolder { /** * Edges to nested namespaces, records, functions, fields etc. contained in the current * namespace. @@ -93,4 +96,15 @@ class NamespaceDeclaration : Declaration(), DeclarationHolder, StatementHolder { override var statements: List by PropertyEdgeDelegate(NamespaceDeclaration::statementEdges) + + override val resolutionStartNodes: List + get() { + val list = mutableListOf() + // Add all top-level declarations + list += declarations + // Add all top-level statements + list += statements + + return list + } }