summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas Lively <7121787+tlively@users.noreply.github.com>2022-05-27 14:19:04 -0700
committerGitHub <noreply@github.com>2022-05-27 14:19:04 -0700
commit410b7c92ea2e36b6a938fc34b4fd11e2eeea9fb3 (patch)
treed519f5e4fd6d8d985c4391598ce1dad2a112f449 /src
parent6b12e320b4546ed18382fa1b191246daa1c3249d (diff)
downloadbinaryen-410b7c92ea2e36b6a938fc34b4fd11e2eeea9fb3.tar.gz
binaryen-410b7c92ea2e36b6a938fc34b4fd11e2eeea9fb3.tar.bz2
binaryen-410b7c92ea2e36b6a938fc34b4fd11e2eeea9fb3.zip
[Parser][NFC] Improve comments about default NaN payloads (#4697)
Diffstat (limited to 'src')
-rw-r--r--src/wasm/wat-lexer.cpp5
-rw-r--r--src/wat-lexer.h2
2 files changed, 7 insertions, 0 deletions
diff --git a/src/wasm/wat-lexer.cpp b/src/wasm/wat-lexer.cpp
index 401ea6b7a..1992e9bab 100644
--- a/src/wasm/wat-lexer.cpp
+++ b/src/wasm/wat-lexer.cpp
@@ -222,6 +222,8 @@ struct LexFloatResult : LexResult {
// The payload if we lexed a nan with payload. We cannot store the payload
// directly in `d` because we do not know at this point whether we are parsing
// an f32 or f64 and therefore we do not know what the allowable payloads are.
+ // No payload with NaN means to use the default payload for the expected float
+ // width.
std::optional<uint64_t> nanPayload;
double d;
};
@@ -602,6 +604,9 @@ std::optional<LexFloatResult> float_(std::string_view in) {
// TODO: Add error production for malformed NaN payload.
return {};
}
+ } else {
+ // No explicit payload necessary; we will inject the default payload
+ // later.
}
} else {
return {};
diff --git a/src/wat-lexer.h b/src/wat-lexer.h
index d5c3b33ce..057d7eed7 100644
--- a/src/wat-lexer.h
+++ b/src/wat-lexer.h
@@ -69,6 +69,8 @@ struct FloatTok {
// The payload if we lexed a nan with payload. We cannot store the payload
// directly in `d` because we do not know at this point whether we are parsing
// an f32 or f64 and therefore we do not know what the allowable payloads are.
+ // No payload with NaN means to use the default payload for the expected float
+ // width.
std::optional<uint64_t> nanPayload;
double d;