summaryrefslogtreecommitdiff
path: root/src/wat-lexer.h
diff options
context:
space:
mode:
authorThomas Lively <7121787+tlively@users.noreply.github.com>2022-05-27 16:58:24 -0700
committerGitHub <noreply@github.com>2022-05-27 16:58:24 -0700
commit838de5c4f374396a15d5700ebb51c3e0a89b5840 (patch)
tree1969623c389959f8341637e58130d5dae8c50be6 /src/wat-lexer.h
parent410b7c92ea2e36b6a938fc34b4fd11e2eeea9fb3 (diff)
downloadbinaryen-838de5c4f374396a15d5700ebb51c3e0a89b5840.tar.gz
binaryen-838de5c4f374396a15d5700ebb51c3e0a89b5840.tar.bz2
binaryen-838de5c4f374396a15d5700ebb51c3e0a89b5840.zip
[Parser] Replace Signedness with ternary Sign (#4698)
Previously we were tracking whether integer tokens were signed but we did not differentiate between positive and negative signs. Unfortunately, without differentiating them, there's no way to tell the difference between an in-bounds negative integer and a wildly out-of-bounds positive integer when trying to perform bounds checks for s32 tokens. Fix the problem by tracking not only whether there is a sign on an integer token, but also what the sign is.
Diffstat (limited to 'src/wat-lexer.h')
-rw-r--r--src/wat-lexer.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/wat-lexer.h b/src/wat-lexer.h
index 057d7eed7..5a955f5c0 100644
--- a/src/wat-lexer.h
+++ b/src/wat-lexer.h
@@ -55,11 +55,11 @@ struct IdTok {
friend std::ostream& operator<<(std::ostream&, const IdTok&);
};
-enum Signedness { Unsigned, Signed };
+enum Sign { NoSign, Pos, Neg };
struct IntTok {
uint64_t n;
- Signedness signedness;
+ Sign sign;
bool operator==(const IntTok&) const;
friend std::ostream& operator<<(std::ostream&, const IntTok&);