From 8dbddf5c922c36a08a3062d8c0071d8503619178 Mon Sep 17 00:00:00 2001 From: Sami Vaarala Date: Sun, 10 Sep 2023 15:45:37 +0300 Subject: [PATCH] ES2021 digit separator trivia Update releases.yaml, add braces for goto. --- releases/releases.yaml | 1 + src-input/duk_lexer.c | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/releases/releases.yaml b/releases/releases.yaml index 8beec93e..45bd2036 100644 --- a/releases/releases.yaml +++ b/releases/releases.yaml @@ -1396,3 +1396,4 @@ duktape_releases: - "Fix JSON.stringify() handling of Array 'replacer' duplicates (e.g. JSON.stringify({foo: 123}, [\"foo\", \"foo\"])); previously incorrectly serialized multiple times, now only once (GH-2379)" - "Add support for DJGPP (MSDOS) platform (GH-2472, GH-2473)" - "Remove .caller and .arguments own properties from both strict and non-strict function objects, and add .caller and .arguments throwers to Function.prototype to match ES2015+ (GH-2482)" + - "Add support for ES2021 digit separator (GH-2537)" diff --git a/src-input/duk_lexer.c b/src-input/duk_lexer.c index 8dc76206..9025ae4e 100644 --- a/src-input/duk_lexer.c +++ b/src-input/duk_lexer.c @@ -1715,8 +1715,12 @@ slow_path: } last_was_digit = 0; } else if (x == DUK_ASC_UNDERSCORE) { - if (!last_was_digit) goto fail_number_literal; - if (s2n_radix != 16 ? !DUK__ISDIGIT(DUK__L1()) : !DUK__ISHEXDIGIT(DUK__L1())) goto fail_number_literal; + if (!last_was_digit) { + goto fail_number_literal; + } + if (s2n_radix != 16 ? !DUK__ISDIGIT(DUK__L1()) : !DUK__ISHEXDIGIT(DUK__L1())) { + goto fail_number_literal; + } DUK__ADVANCECHARS(lex_ctx, 1); last_was_digit = 0; continue;