Skip to content

Commit 410b7c9

Browse files
authored
[Parser][NFC] Improve comments about default NaN payloads (#4697)
1 parent 6b12e32 commit 410b7c9

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/wasm/wat-lexer.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,8 @@ struct LexFloatResult : LexResult {
222222
// The payload if we lexed a nan with payload. We cannot store the payload
223223
// directly in `d` because we do not know at this point whether we are parsing
224224
// an f32 or f64 and therefore we do not know what the allowable payloads are.
225+
// No payload with NaN means to use the default payload for the expected float
226+
// width.
225227
std::optional<uint64_t> nanPayload;
226228
double d;
227229
};
@@ -602,6 +604,9 @@ std::optional<LexFloatResult> float_(std::string_view in) {
602604
// TODO: Add error production for malformed NaN payload.
603605
return {};
604606
}
607+
} else {
608+
// No explicit payload necessary; we will inject the default payload
609+
// later.
605610
}
606611
} else {
607612
return {};

src/wat-lexer.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ struct FloatTok {
6969
// The payload if we lexed a nan with payload. We cannot store the payload
7070
// directly in `d` because we do not know at this point whether we are parsing
7171
// an f32 or f64 and therefore we do not know what the allowable payloads are.
72+
// No payload with NaN means to use the default payload for the expected float
73+
// width.
7274
std::optional<uint64_t> nanPayload;
7375
double d;
7476

0 commit comments

Comments
 (0)