summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rw-r--r--source/slang/slang.cpp20
1 files changed, 14 insertions, 6 deletions
diff --git a/source/slang/slang.cpp b/source/slang/slang.cpp
index b79d97331..1362cb038 100644
--- a/source/slang/slang.cpp
+++ b/source/slang/slang.cpp
@@ -822,13 +822,21 @@ SLANG_NO_THROW slang::IModule* SLANG_MCALL Linkage::loadModule(
const char* moduleName,
slang::IBlob** outDiagnostics)
{
- auto name = getNamePool()->getName(moduleName);
+ try
+ {
+ auto name = getNamePool()->getName(moduleName);
- DiagnosticSink sink(getSourceManager(), Lexer::sourceLocationLexer);
- auto module = findOrImportModule(name, SourceLoc(), &sink);
- sink.getBlobIfNeeded(outDiagnostics);
+ DiagnosticSink sink(getSourceManager(), Lexer::sourceLocationLexer);
+ auto module = findOrImportModule(name, SourceLoc(), &sink);
+ sink.getBlobIfNeeded(outDiagnostics);
+
+ return asExternal(module);
- return asExternal(module);
+ }
+ catch (const AbortCompilationException&)
+ {
+ return nullptr;
+ }
}
SLANG_NO_THROW SlangResult SLANG_MCALL Linkage::createCompositeComponentType(
@@ -2454,7 +2462,7 @@ void Linkage::_diagnoseErrorInImportedModule(
{
for(auto info = m_modulesBeingImported; info; info = info->next)
{
- sink->diagnose(info->importLoc, Diagnostics::errorInImportedModule, info->name);
+ sink->diagnose(info->importLoc, Diagnostics::errorInImportedModule, info->name);
}
sink->diagnose(SourceLoc(), Diagnostics::complationCeased);
}