diff options
| author | Tim Foley <tfoleyNV@users.noreply.github.com> | 2018-04-13 13:36:26 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-04-13 13:36:26 -0700 |
| commit | 15bff9162530113b426664eb0c1deb7ea9e3a90d (patch) | |
| tree | 99dc8a40a76ff9fa08322711402cd2ea8deb4edc /source | |
| parent | 021a4923f429278b1d7434e01cbf83edcdf43da4 (diff) | |
Propagate diagnostics when imported module has errors (#485)
A previous fix avoided crashes when an `import`ed module has errors by making the "failed to import" error a fatal one.
Unfortunately, the code path that handles fatal errors was failing to copy diagnostic output from the sink over to the member variable on the `CompileRequest` that exposes the output through the API.
This meant that API users lost all context on error messages in `import`ed code.
This change fixes the immediate issue by plumbing through the error output, but doesn't fix the more fundamental issue: the front-end should not crash when an `import` fails, by any means.
Diffstat (limited to 'source')
| -rw-r--r-- | source/slang/slang.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/source/slang/slang.cpp b/source/slang/slang.cpp index 5df180f46..dbd48753b 100644 --- a/source/slang/slang.cpp +++ b/source/slang/slang.cpp @@ -1120,6 +1120,10 @@ SLANG_API int spCompile( { // This should only be thrown if we already emitted a fatal error // message, so there is no reason to print something else. + // + // We still need to copy the diagnostic output into the variable + // that the user will query via the API. + req->mDiagnosticOutput = req->mSink.outputBuffer.ProduceString(); return 1; } catch (...) |
