Browse Source

ES2021 digit separator trivia

Update releases.yaml, add braces for goto.
pull/2543/head
Sami Vaarala 1 year ago
parent
commit
8dbddf5c92
  1. 1
      releases/releases.yaml
  2. 8
      src-input/duk_lexer.c

1
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)" - "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)" - "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)" - "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)"

8
src-input/duk_lexer.c

@ -1715,8 +1715,12 @@ slow_path:
} }
last_was_digit = 0; last_was_digit = 0;
} else if (x == DUK_ASC_UNDERSCORE) { } else if (x == DUK_ASC_UNDERSCORE) {
if (!last_was_digit) goto fail_number_literal; if (!last_was_digit) {
if (s2n_radix != 16 ? !DUK__ISDIGIT(DUK__L1()) : !DUK__ISHEXDIGIT(DUK__L1())) goto fail_number_literal; 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); DUK__ADVANCECHARS(lex_ctx, 1);
last_was_digit = 0; last_was_digit = 0;
continue; continue;

Loading…
Cancel
Save