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/compiler-core/slang-json-source-map-util.h | |
| 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/compiler-core/slang-json-source-map-util.h')
| -rw-r--r-- | source/compiler-core/slang-json-source-map-util.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/source/compiler-core/slang-json-source-map-util.h b/source/compiler-core/slang-json-source-map-util.h index ba417dd7c..8d5071d4e 100644 --- a/source/compiler-core/slang-json-source-map-util.h +++ b/source/compiler-core/slang-json-source-map-util.h @@ -18,6 +18,12 @@ struct JSONSourceMapUtil /// Read the blob (encoded as JSON) as a source map. /// Sink is optional, and can be passed as nullptr static SlangResult read(ISlangBlob* blob, DiagnosticSink* sink, RefPtr<SourceMap>& outSourceMap); + static SlangResult read(ISlangBlob* blob, RefPtr<SourceMap>& outSourceMap); + + /// Write source map to outBlob JSON + static SlangResult write(SourceMap* sourceMap, ComPtr<ISlangBlob>& outBlob); + /// Write out the source map into a blob + static SlangResult write(SourceMap* sourceMap, DiagnosticSink* sink, ComPtr<ISlangBlob>& outBlob); }; } // namespace Slang |
