diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2023-04-19 17:06:56 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-04-19 17:06:56 -0400 |
| commit | 588991f6df3d6813378721166a7260990835817e (patch) | |
| tree | fca8c57fedb1967af20ca2da50bbd7dc8afc6a07 /source/slang/slang-emit.cpp | |
| parent | 520a3c064c42e8cd50ef4fde21539870d5b19cb7 (diff) | |
Make SourceMap a value type (#2812)
* #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.
* Make some types swappable.
* BoxValue impl.
* Added asBoxValue.
* Remove const get funcs.
* Fix typo in asBoxValue.
* Fix another typo in asBoxValue.
* Slightly simplify conversion to blob of SourceMap.
* Small fix for asBoxValue
Diffstat (limited to 'source/slang/slang-emit.cpp')
| -rw-r--r-- | source/slang/slang-emit.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/source/slang/slang-emit.cpp b/source/slang/slang-emit.cpp index 67a4c4610..f9284d001 100644 --- a/source/slang/slang-emit.cpp +++ b/source/slang/slang-emit.cpp @@ -969,12 +969,12 @@ SlangResult CodeGenContext::emitEntryPointsSourceFromIR(ComPtr<IArtifact>& outAr lineDirectiveMode = LineDirectiveMode::GLSL; } - RefPtr<SourceMap> sourceMap; + ComPtr<IBoxValue<SourceMap>> sourceMap; // If SourceMap is enabled, we create one and associate it with the sourceWriter if (targetRequest->getLinkage()->m_generateSourceMap) { - sourceMap = new SourceMap; + sourceMap = new BoxValue<SourceMap>; } SourceWriter sourceWriter(sourceManager, lineDirectiveMode, sourceMap ); @@ -1154,8 +1154,7 @@ SlangResult CodeGenContext::emitEntryPointsSourceFromIR(ComPtr<IArtifact>& outAr { auto sourceMapArtifact = ArtifactUtil::createArtifact(ArtifactDesc::make(ArtifactKind::Json, ArtifactPayload::SourceMap, ArtifactStyle::None)); - ComPtr<IObjectCastableAdapter> castableAdapter(new ObjectCastableAdapter(sourceMap)); - sourceMapArtifact->addRepresentation(castableAdapter); + sourceMapArtifact->addRepresentation(sourceMap); artifact->addAssociated(sourceMapArtifact); } |
