diff options
Diffstat (limited to 'source/slang/slang.cpp')
| -rw-r--r-- | source/slang/slang.cpp | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/source/slang/slang.cpp b/source/slang/slang.cpp index 498dc67f5..a1627286d 100644 --- a/source/slang/slang.cpp +++ b/source/slang/slang.cpp @@ -3302,22 +3302,33 @@ RefPtr<Module> Linkage::loadModule( return nullptr; } - loadParsedModule( - frontEndReq, - translationUnit, - name, - filePathInfo); - + try + { + loadParsedModule( + frontEndReq, + translationUnit, + name, + filePathInfo); + } + catch (const Slang::AbortCompilationException&) + { + // Something is fatally wrong, we should return nullptr. + module = nullptr; + } errorCountAfter = sink->getErrorCount(); if (errorCountAfter != errorCountBefore && !isInLanguageServer()) { + // If something is fatally wrong, we want to report + // the diagnostic even if we are in language server + // and processing a different module. _diagnoseErrorInImportedModule(sink); // Something went wrong during the parsing, so we should bail out. return nullptr; } - module->setPathInfo(filePathInfo); + if (module) + module->setPathInfo(filePathInfo); return module; } |
