diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2023-04-18 12:36:06 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-04-18 12:36:06 -0400 |
| commit | 181fd1f3c9c4b047c1947096e7b3f8e5bc2314c3 (patch) | |
| tree | 308cbadae2f68d43ca20f92755b08db08e8b2283 /source/slang/slang.cpp | |
| parent | 90a9f43573ec0777c2ae4fa20c8fdc51a4ae7b3a (diff) | |
On demand SourceMap JSON serialization (#2811)
* #include an absolute path didn't work - because paths were taken to always be relative.
* Moved JSON source map writing logic to JSONSourceMapUtil.
* Use ArtifactHandler to read/write SourceMaps.
Use ObjectCastableAdapter to hold SourceMap
Only serialize SourceMap <-> JSON on demand.
Diffstat (limited to 'source/slang/slang.cpp')
| -rw-r--r-- | source/slang/slang.cpp | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/source/slang/slang.cpp b/source/slang/slang.cpp index c8cda0dca..bedfb1161 100644 --- a/source/slang/slang.cpp +++ b/source/slang/slang.cpp @@ -15,8 +15,6 @@ #include "../compiler-core/slang-artifact-associated-impl.h" #include "../compiler-core/slang-artifact-container-util.h" -#include "../compiler-core/slang-json-source-map-util.h" - #include "../core/slang-memory-file-system.h" #include "slang-module-library.h" @@ -4884,12 +4882,11 @@ SlangResult _addLibraryReference(EndToEndCompileRequest* req, IArtifact* artifac isDerivedFrom(assocDesc.payload, ArtifactPayload::SourceMap) && isDerivedFrom(assocDesc.style, ArtifactStyle::Obfuscated)) { - ComPtr<ISlangBlob> sourceMapBlob; - SLANG_RETURN_ON_FAIL(associated->loadBlob(ArtifactKeep::No, sourceMapBlob.writeRef())); + ComPtr<ICastable> castable; + SLANG_RETURN_ON_FAIL(associated->getOrCreateRepresentation(SourceMap::getTypeGuid(), ArtifactKeep::Yes, castable.writeRef())); + + auto sourceMap = as<SourceMap>(castable); - RefPtr<SourceMap> sourceMap; - SLANG_RETURN_ON_FAIL(JSONSourceMapUtil::read(sourceMapBlob, nullptr, sourceMap)); - // I guess we add to all ir modules? for (auto irModule : library->m_modules) |
