diff options
| author | Yong He <yonghe@outlook.com> | 2024-02-20 23:13:29 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-02-20 23:13:29 -0800 |
| commit | 2e2c7943da89b0100db3bba4b11267b5a857ca92 (patch) | |
| tree | 8cbf8010e964cdbb7381fa15b1062b2c43cbd870 /source/slang/slang.cpp | |
| parent | 2ee05c1257c916e5c804a6b565a2a6aa362050e0 (diff) | |
Language server robustness fix. (#3607)
* Language server robustness fix.
* Allow parameter name to be the same as its type.
* fix
* Fix test.
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; } |
