From 181fd1f3c9c4b047c1947096e7b3f8e5bc2314c3 Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Tue, 18 Apr 2023 12:36:06 -0400 Subject: 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. --- source/compiler-core/slang-json-source-map-util.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'source/compiler-core/slang-json-source-map-util.h') 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& outSourceMap); + static SlangResult read(ISlangBlob* blob, RefPtr& outSourceMap); + + /// Write source map to outBlob JSON + static SlangResult write(SourceMap* sourceMap, ComPtr& outBlob); + /// Write out the source map into a blob + static SlangResult write(SourceMap* sourceMap, DiagnosticSink* sink, ComPtr& outBlob); }; } // namespace Slang -- cgit v1.2.3