From 3386e642c76028438fc783bf97089115ea9a900f Mon Sep 17 00:00:00 2001 From: Frank Emrich Date: Fri, 9 Aug 2024 21:30:56 +0100 Subject: Typed continuations: update syntax of handler clauses (#6824) The syntax for handler clauses in `resume` instructions has recently changed, using `on` instead of `tag` now. Instead of ``` (resume $ct (tag $tag0 $block0) ... (tag $tagn $blockn)) ``` we now have ``` (resume $ct (on $tag0 $block0) ... (on $tagn $blockn)) ``` This PR adapts parsing, printing, and some tests accordingly. (Note that this PR deliberately makes none of the other changes that will arise from implementing the new, combined stack switching proposal, yet.) --- src/parser/parsers.h | 4 ++-- src/passes/Print.cpp | 4 +--- 2 files changed, 3 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/parser/parsers.h b/src/parser/parsers.h index e3434d1e6..ef46a395a 100644 --- a/src/parser/parsers.h +++ b/src/parser/parsers.h @@ -2426,7 +2426,7 @@ makeContNew(Ctx& ctx, Index pos, const std::vector& annotations) { return ctx.makeContNew(pos, annotations, *type); } -// resume ::= 'resume' typeidx ('(' 'tag' tagidx labelidx ')')* +// resume ::= 'resume' typeidx ('(' 'on' tagidx labelidx ')')* template Result<> makeResume(Ctx& ctx, Index pos, const std::vector& annotations) { @@ -2434,7 +2434,7 @@ makeResume(Ctx& ctx, Index pos, const std::vector& annotations) { CHECK_ERR(type); auto tagLabels = ctx.makeTagLabelList(); - while (ctx.in.takeSExprStart("tag"sv)) { + while (ctx.in.takeSExprStart("on"sv)) { auto tag = tagidx(ctx); CHECK_ERR(tag); auto label = labelidx(ctx); diff --git a/src/passes/Print.cpp b/src/passes/Print.cpp index 5c83e89f1..8bf30702c 100644 --- a/src/passes/Print.cpp +++ b/src/passes/Print.cpp @@ -2374,11 +2374,9 @@ struct PrintExpressionContents o << ' '; printHeapType(curr->contType); - // We deliberate keep all (tag ...) clauses on the same line as the resume - // itself to work around a quirk in update_lit_checks.py for (Index i = 0; i < curr->handlerTags.size(); i++) { o << " ("; - printMedium(o, "tag "); + printMedium(o, "on "); curr->handlerTags[i].print(o); o << ' '; curr->handlerBlocks[i].print(o); -- cgit v1.2.3