From ca1f93a916ce6b984cba402c8d3710988f2b618f Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Mon, 27 Mar 2023 13:57:42 -0400 Subject: 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 --- tools/slang-unit-test/unit-test-source-map.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'tools/slang-unit-test/unit-test-source-map.cpp') 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; - 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); -- cgit v1.2.3