diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2023-04-20 13:42:20 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-04-20 13:42:20 -0400 |
| commit | 088644c21c015eb60a41a59f417990023f1f4ef8 (patch) | |
| tree | 596d224f99e35dcd3d66507cfe297bc25407336d /source/compiler-core/slang-json-source-map-util.cpp | |
| parent | 4e67cdedbef8f643c90b48172d5419d3dd1839db (diff) | |
Improve SourceMap coverage/testing (#2818)
* #include an absolute path didn't work - because paths were taken to always be relative.
* WIP around more value like behavior for SourceMap/StringPool.
* Use default impls on SourceMap ctor/assignment.
* Handle comparison of SourceMaps.
Some small fixes.
Expand unit tests.
Diffstat (limited to 'source/compiler-core/slang-json-source-map-util.cpp')
| -rw-r--r-- | source/compiler-core/slang-json-source-map-util.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/source/compiler-core/slang-json-source-map-util.cpp b/source/compiler-core/slang-json-source-map-util.cpp index 193c812b7..30d722c4c 100644 --- a/source/compiler-core/slang-json-source-map-util.cpp +++ b/source/compiler-core/slang-json-source-map-util.cpp @@ -209,6 +209,7 @@ void _encode(Index v, StringBuilder& out) cur = StringSlicePool::kNullHandle; } + // Special case sourcesContent, because needs to be able to handle null or string for (Index i = 0; i < sourcesContentCount; ++i) { auto value = native.sourcesContent[i]; @@ -223,6 +224,17 @@ void _encode(Index v, StringBuilder& out) } } + // Copy over the names + { + const auto namesCount = native.names.getCount(); + outSourceMap.m_names.setCount(namesCount); + + for (Index i = 0; i < namesCount; ++i) + { + outSourceMap.m_names[i] = outSourceMap.m_slicePool.add(native.names[i]); + } + } + List<UnownedStringSlice> lines; StringUtil::split(native.mappings, ';', lines); |
