Skip to content

Commit 457d092

Browse files
committed
Fixed tests
1 parent 0fd6352 commit 457d092

File tree

1 file changed

+2
-2
lines changed
  • cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/passes/inference

1 file changed

+2
-2
lines changed

cpg-core/src/main/kotlin/de/fraunhofer/aisec/cpg/passes/inference/PassHelper.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ fun Pass<*>.tryNamespaceInference(name: Name, source: Node): NamespaceDeclaratio
8383
holder = tryScopeInference(parentName, source)
8484
}
8585

86-
return (holder ?: source.translationUnit)
86+
return (holder ?: source.translationUnit ?: scopeManager.globalScope?.astNode)
8787
?.startInference(ctx)
8888
?.inferNamespaceDeclaration(name, null, source)
8989
}
@@ -133,7 +133,7 @@ internal fun Pass<*>.tryRecordInference(type: Type, source: Node): RecordDeclara
133133
}
134134

135135
val record =
136-
(holder ?: source.translationUnit)
136+
(holder ?: source.translationUnit ?: scopeManager.globalScope?.astNode)
137137
?.startInference(ctx)
138138
?.inferRecordDeclaration(type, kind, source)
139139

0 commit comments

Comments
 (0)