summaryrefslogtreecommitdiff
path: root/source/slang/slang-check-decl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/slang-check-decl.cpp')
-rw-r--r--source/slang/slang-check-decl.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/source/slang/slang-check-decl.cpp b/source/slang/slang-check-decl.cpp
index ce3f1e64c..3667a36ba 100644
--- a/source/slang/slang-check-decl.cpp
+++ b/source/slang/slang-check-decl.cpp
@@ -3186,6 +3186,11 @@ void SemanticsDeclVisitorBase::checkModule(ModuleDecl* moduleDecl)
}
}
+ if (moduleDecl->findModifier<PublicModifier>())
+ {
+ moduleDecl->defaultVisibility = DeclVisibility::Public;
+ }
+
// We need/want to visit any `import` declarations before
// anything else, to make sure that scoping works.
//
@@ -12604,8 +12609,10 @@ DeclVisibility getDeclVisibility(Decl* decl)
}
auto defaultVis = DeclVisibility::Default;
if (auto parentModule = getModuleDecl(decl))
- defaultVis =
- parentModule->isInLegacyLanguage ? DeclVisibility::Public : DeclVisibility::Internal;
+ {
+ defaultVis = parentModule->isInLegacyLanguage ? DeclVisibility::Public
+ : parentModule->defaultVisibility;
+ }
// Members of other agg type decls will have their default visibility capped to the parents'.
if (as<NamespaceDecl>(decl))
@@ -12790,10 +12797,6 @@ void diagnoseCapabilityProvenance(
auto moduleDecl = getModuleDecl(declToPrint);
if (thisModule != moduleDecl)
break;
- if (moduleDecl && moduleDecl->isInLegacyLanguage)
- continue;
- if (getDeclVisibility(declToPrint) == DeclVisibility::Public)
- break;
}
if (previousDecl == declToPrint)
break;