summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2023-03-27 13:57:42 -0400
committerGitHub <noreply@github.com>2023-03-27 10:57:42 -0700
commitca1f93a916ce6b984cba402c8d3710988f2b618f (patch)
treef39b638210d38efdc7e2bb746c06b881323d0f53 /tools
parent2179480e28bdd46c71cec269a8f55ba93aa54f53 (diff)
Using SourceMap for location output (#2736)
* #include an absolute path didn't work - because paths were taken to always be relative. * WIP using SourceMap with SourceManager. * Add a test to check obfuscation map is working. --------- Co-authored-by: Yong He <yonghe@outlook.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/slang-unit-test/unit-test-source-map.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/tools/slang-unit-test/unit-test-source-map.cpp b/tools/slang-unit-test/unit-test-source-map.cpp
index b973a9c62..bf97096e9 100644
--- a/tools/slang-unit-test/unit-test-source-map.cpp
+++ b/tools/slang-unit-test/unit-test-source-map.cpp
@@ -7,6 +7,7 @@
#include "../../source/compiler-core/slang-json-native.h"
#include "../../source/compiler-core/slang-source-map.h"
+#include "../../source/compiler-core/slang-json-source-map-util.h"
#include "../../source/core/slang-rtti-info.h"
@@ -52,16 +53,16 @@ static SlangResult _check()
rootValue = builder.getRootValue();
}
- SourceMap sourceMap;
+ RefPtr<SourceMap> sourceMap;
- SLANG_RETURN_ON_FAIL(sourceMap.decode(container, rootValue, &sink));
+ SLANG_RETURN_ON_FAIL(JSONSourceMapUtil::decode(container, rootValue, &sink, sourceMap));
// Write it out
String json;
{
JSONValue jsonValue;
- SLANG_RETURN_ON_FAIL(sourceMap.encode(container, &sink, jsonValue));
+ SLANG_RETURN_ON_FAIL(JSONSourceMapUtil::encode(sourceMap, container, &sink, jsonValue));
// Convert into a string
JSONWriter writer(JSONWriter::IndentationStyle::Allman);