diff options
author | Thomas Lively <tlively@google.com> | 2024-04-29 10:58:53 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-29 10:58:53 -0700 |
commit | 90ead54ae117083cf720d0cc807abee9ebcfbf98 (patch) | |
tree | 0d2736cda4aca8dc35e90b7d6665af550037b96e /src/parser/parsers.h | |
parent | 9b65160e13c6d1a087b6c952a903b0b836585d97 (diff) | |
download | binaryen-90ead54ae117083cf720d0cc807abee9ebcfbf98.tar.gz binaryen-90ead54ae117083cf720d0cc807abee9ebcfbf98.tar.bz2 binaryen-90ead54ae117083cf720d0cc807abee9ebcfbf98.zip |
[Parser][NFC] Clean up the lexer index/pos API (#6553)
The lexer previously had both `getPos` and `getIndex` APIs that did different
things, but after a recent refactoring there is no difference between the index
and the position. Deduplicate the API surface.
Diffstat (limited to 'src/parser/parsers.h')
-rw-r--r-- | src/parser/parsers.h | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/parser/parsers.h b/src/parser/parsers.h index 25078f354..4d54b3655 100644 --- a/src/parser/parsers.h +++ b/src/parser/parsers.h @@ -372,11 +372,11 @@ template<typename Ctx> struct WithPosition { WithPosition(Ctx& ctx, Index pos) : ctx(ctx), original(ctx.in.getPos()), annotations(ctx.in.takeAnnotations()) { - ctx.in.setIndex(pos); + ctx.in.setPos(pos); } ~WithPosition() { - ctx.in.setIndex(original); + ctx.in.setPos(original); ctx.in.setAnnotations(std::move(annotations)); } }; @@ -1325,7 +1325,7 @@ trycatch(Ctx& ctx, const std::vector<Annotation>& annotations, bool folded) { if (id && id != label) { // Instead of returning an error, retry without the ID. parseID = false; - ctx.in.setIndex(afterCatchPos); + ctx.in.setPos(afterCatchPos); continue; } } @@ -1334,7 +1334,7 @@ trycatch(Ctx& ctx, const std::vector<Annotation>& annotations, bool folded) { if (parseID && tag.getErr()) { // Instead of returning an error, retry without the ID. parseID = false; - ctx.in.setIndex(afterCatchPos); + ctx.in.setPos(afterCatchPos); continue; } CHECK_ERR(tag); @@ -3375,7 +3375,7 @@ template<typename Ctx> MaybeResult<> elem(Ctx& ctx) { offset = *off; } else { // This must be the beginning of the elemlist instead. - ctx.in.setIndex(beforeLParen); + ctx.in.setPos(beforeLParen); } } } |