From 53f8d5f7bd32c8b47ee235033f3f913a8f3f2d09 Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Mon, 4 Mar 2024 15:50:38 -0800 Subject: [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. --- src/parser/wat-parser.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/parser/wat-parser.cpp') 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 { -- cgit v1.2.3