summaryrefslogtreecommitdiff
path: root/source/slang/slang.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/slang.cpp')
-rw-r--r--source/slang/slang.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/source/slang/slang.cpp b/source/slang/slang.cpp
index e149058b1..e98187c85 100644
--- a/source/slang/slang.cpp
+++ b/source/slang/slang.cpp
@@ -4131,8 +4131,18 @@ void Linkage::loadParsedModule(
auto sink = translationUnit->compileRequest->getSink();
int errorCountBefore = sink->getErrorCount();
- compileRequest->checkAllTranslationUnits();
- int errorCountAfter = sink->getErrorCount();
+ int errorCountAfter;
+ try
+ {
+ compileRequest->checkAllTranslationUnits();
+ }
+ catch (...)
+ {
+ mapPathToLoadedModule.remove(mostUniqueIdentity);
+ mapNameToLoadedModules.remove(name);
+ throw;
+ }
+ errorCountAfter = sink->getErrorCount();
if (isInLanguageServer())
{
// Don't generate IR as language server.