diff options
author | Thomas Lively <tlively@google.com> | 2024-03-04 15:50:38 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-04 15:50:38 -0800 |
commit | 53f8d5f7bd32c8b47ee235033f3f913a8f3f2d09 (patch) | |
tree | 99644473dd8a8f2d787465c583ca19fc3c46ac1a /src/parser/wat-parser.cpp | |
parent | e6cd45629860d43f9c8ab34c81c6b3b4455ec49d (diff) | |
download | binaryen-53f8d5f7bd32c8b47ee235033f3f913a8f3f2d09.tar.gz binaryen-53f8d5f7bd32c8b47ee235033f3f913a8f3f2d09.tar.bz2 binaryen-53f8d5f7bd32c8b47ee235033f3f913a8f3f2d09.zip |
[Parser] Support prologue and epilogue sourcemap annotations (#6370)
and fix a bug with sourcemap annotations on folded `if` conditions. Update
IRBuilder to apply prologue and epilogue source locations when beginning and ending
a function scope. Add basic support in the parser for explicitly tracking
annotations on module fields, although only do anything with them in the case of
prologue source location annotations.
Diffstat (limited to 'src/parser/wat-parser.cpp')
-rw-r--r-- | src/parser/wat-parser.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/parser/wat-parser.cpp b/src/parser/wat-parser.cpp index ff0dea768..8675f4e36 100644 --- a/src/parser/wat-parser.cpp +++ b/src/parser/wat-parser.cpp @@ -184,10 +184,11 @@ Result<> parseModule(Module& wasm, std::string_view input) { for (Index i = 0; i < decls.funcDefs.size(); ++i) { ctx.index = i; auto* f = wasm.functions[i].get(); + WithPosition with(ctx, decls.funcDefs[i].pos); + ctx.setSrcLoc(decls.funcDefs[i].annotations); if (!f->imported()) { CHECK_ERR(ctx.visitFunctionStart(f)); } - WithPosition with(ctx, decls.funcDefs[i].pos); if (auto parsed = func(ctx)) { CHECK_ERR(parsed); } else { |