summaryrefslogtreecommitdiff
path: root/src/parser/contexts.h
diff options
context:
space:
mode:
authorJérôme Vouillon <jerome.vouillon@gmail.com>2024-05-14 16:01:01 -0400
committerGitHub <noreply@github.com>2024-05-14 13:01:01 -0700
commit140386ed24ece9f30b2ad7dc55f63716f7a61f5e (patch)
treebebd167535305fbeaad79779e25ecc73b233c502 /src/parser/contexts.h
parent55f33b55daa965672d2b8aca98ce1570e3fb52c0 (diff)
downloadbinaryen-140386ed24ece9f30b2ad7dc55f63716f7a61f5e.tar.gz
binaryen-140386ed24ece9f30b2ad7dc55f63716f7a61f5e.tar.bz2
binaryen-140386ed24ece9f30b2ad7dc55f63716f7a61f5e.zip
Source maps: Allow specifying that an expression has no debug info in text (#6520)
;;@ with nothing else (no source:line) can be used to specify that the following expression does not have any debug info associated to it. This can be used to stop the automatic propagation of debug info in the text parsers. The text printer has also been updated to output this comment when needed.
Diffstat (limited to 'src/parser/contexts.h')
-rw-r--r--src/parser/contexts.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/parser/contexts.h b/src/parser/contexts.h
index 3e42d0d6b..f66e3d051 100644
--- a/src/parser/contexts.h
+++ b/src/parser/contexts.h
@@ -1731,6 +1731,11 @@ struct ParseDefsCtx : TypeParserCtx<ParseDefsCtx> {
return;
}
Lexer lexer(annotation->contents);
+ if (lexer.empty()) {
+ irBuilder.setDebugLocation(std::nullopt);
+ return;
+ }
+
auto contents = lexer.takeKeyword();
if (!contents || !lexer.empty()) {
return;
@@ -1766,7 +1771,8 @@ struct ParseDefsCtx : TypeParserCtx<ParseDefsCtx> {
assert(wasm.debugInfoFileNames.size() == it->second);
wasm.debugInfoFileNames.push_back(std::string(file));
}
- irBuilder.setDebugLocation({it->second, *line, *col});
+ irBuilder.setDebugLocation(
+ Function::DebugLocation({it->second, *line, *col}));
}
Result<> makeBlock(Index pos,