summaryrefslogtreecommitdiff
path: root/source/compiler-core/slang-source-loc.cpp
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2023-04-19 17:06:56 -0400
committerGitHub <noreply@github.com>2023-04-19 17:06:56 -0400
commit588991f6df3d6813378721166a7260990835817e (patch)
treefca8c57fedb1967af20ca2da50bbd7dc8afc6a07 /source/compiler-core/slang-source-loc.cpp
parent520a3c064c42e8cd50ef4fde21539870d5b19cb7 (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/compiler-core/slang-source-loc.cpp')
-rw-r--r--source/compiler-core/slang-source-loc.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/source/compiler-core/slang-source-loc.cpp b/source/compiler-core/slang-source-loc.cpp
index 23cbdf839..3d992ee8d 100644
--- a/source/compiler-core/slang-source-loc.cpp
+++ b/source/compiler-core/slang-source-loc.cpp
@@ -211,7 +211,7 @@ SlangResult _findLocWithSourceMap(SourceManager* lookupSourceManager, SourceView
auto sourceMap = sourceFile->getSourceMap();
SLANG_ASSERT(sourceMap);
- entryIndex = sourceMap->findEntry(lineIndex, colIndex);
+ entryIndex = sourceMap->get().findEntry(lineIndex, colIndex);
}
if (entryIndex < 0)
@@ -222,7 +222,7 @@ SlangResult _findLocWithSourceMap(SourceManager* lookupSourceManager, SourceView
// Keep searching through source maps
do
{
- auto sourceMap = sourceFile->getSourceMap();
+ auto sourceMap = sourceFile->getSourceMap()->getPtr();
// Find the entry
const auto& entry = sourceMap->getEntryByIndex(entryIndex);
@@ -242,7 +242,7 @@ SlangResult _findLocWithSourceMap(SourceManager* lookupSourceManager, SourceView
// If it has a source map, we try and look up the current location in it's source map
if (auto foundSourceMap = foundSourceFile->getSourceMap())
{
- const auto foundEntryIndex = foundSourceMap->findEntry(entry.sourceLine, entry.sourceColumn);
+ const auto foundEntryIndex = foundSourceMap->get().findEntry(entry.sourceLine, entry.sourceColumn);
// If we found the entry repeat the lookup
if (foundEntryIndex >= 0)
@@ -258,7 +258,7 @@ SlangResult _findLocWithSourceMap(SourceManager* lookupSourceManager, SourceView
} while (false);
// Generate the HandleSourceLoc
- auto sourceMap = sourceFile->getSourceMap();
+ auto sourceMap = sourceFile->getSourceMap()->getPtr();
const auto& entry = sourceMap->getEntryByIndex(entryIndex);
// We need to add the pool of the originating source view/file