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.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/source/slang/slang.cpp b/source/slang/slang.cpp
index c25a4f2ce..a918fa356 100644
--- a/source/slang/slang.cpp
+++ b/source/slang/slang.cpp
@@ -529,9 +529,16 @@ RefPtr<ModuleDecl> CompileRequest::loadModule(
translationUnit->sourceFiles.Add(sourceFile);
+
+ int errorCountBefore = mSink.GetErrorCount();
parseTranslationUnit(translationUnit.Ptr());
+ int errorCountAfter = mSink.GetErrorCount();
- // TODO: handle errors
+ if( errorCountAfter != errorCountBefore )
+ {
+ // Something went wrong during the parsing, so we should bail out.
+ return nullptr;
+ }
loadParsedModule(
translationUnit,