GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — deps: V8: cherry-pick 249de887a8d3 · nodejs/node@efb28f7

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • common.gypi
  • deps/v8
    • src/parsing
      • parser-base.h
    • test/mjsunit/harmony
      • for-using-of-await-using-of.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎common.gypi‎

Copy file name to clipboardExpand all lines: common.gypi
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838

3939
# Reset this number to 0 on major V8 upgrades.
4040
# Increment by one for each non-official patch applied to deps/v8.
41-
'v8_embedder_string': '-node.16',
41+
'v8_embedder_string': '-node.17',
4242

4343
##### V8 defaults for Node.js #####
4444

Collapse file

‎deps/v8/src/parsing/parser-base.h‎

Copy file name to clipboardExpand all lines: deps/v8/src/parsing/parser-base.h
+16-6Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1178,15 +1178,16 @@ class ParserBase {
11781178
scope()->scope_type() == REPL_MODE_SCOPE) &&
11791179
!scope()->is_nonlinear());
11801180
}
1181-
bool IsNextUsingKeyword(Token::Value token_after_using, bool is_await_using) {
1181+
bool IsNextUsingKeyword(bool is_await_using) {
11821182
// using and await using declarations in for-of statements must be followed
1183-
// by a non-pattern ForBinding. In the case of synchronous `using`, `of` is
1184-
// disallowed as well with a negative lookahead.
1183+
// by a non-pattern ForBinding.
11851184
//
11861185
// `of`: for ( [lookahead ≠ using of] ForDeclaration[?Yield, ?Await, +Using]
11871186
// of AssignmentExpression[+In, ?Yield, ?Await] )
11881187
//
11891188
// If `using` is not considered a keyword, it is parsed as an identifier.
1189+
Token::Value token_after_using =
1190+
is_await_using ? PeekAheadAhead() : PeekAhead();
11901191
if (v8_flags.js_explicit_resource_management) {
11911192
switch (token_after_using) {
11921193
case Token::kIdentifier:
@@ -1201,7 +1202,16 @@ class ParserBase {
12011202
case Token::kAsync:
12021203
return true;
12031204
case Token::kOf:
1204-
return is_await_using;
1205+
if (is_await_using) {
1206+
return true;
1207+
} else {
1208+
// In the case of synchronous `using`, `of` is disallowed as well
1209+
// with a negative lookahead for for-of loops. But, cursedly,
1210+
// `using of` is allowed as the initializer of C-style for loops,
1211+
// e.g. `for (using of = null;;)` parses.
1212+
Token::Value token_after_of = PeekAheadAhead();
1213+
return token_after_of == Token::kAssign;
1214+
}
12051215
case Token::kFutureStrictReservedWord:
12061216
case Token::kEscapedStrictReservedWord:
12071217
return is_sloppy(language_mode());
@@ -1220,12 +1230,12 @@ class ParserBase {
12201230
// LineTerminator here] ForBinding[?Yield, +Await, ~Pattern]
12211231
return ((peek() == Token::kUsing &&
12221232
!scanner()->HasLineTerminatorAfterNext() &&
1223-
IsNextUsingKeyword(PeekAhead(), /* is_await_using */ false)) ||
1233+
IsNextUsingKeyword(/* is_await_using */ false)) ||
12241234
(is_await_allowed() && peek() == Token::kAwait &&
12251235
!scanner()->HasLineTerminatorAfterNext() &&
12261236
PeekAhead() == Token::kUsing &&
12271237
!scanner()->HasLineTerminatorAfterNextNext() &&
1228-
IsNextUsingKeyword(PeekAheadAhead(), /* is_await_using */ true)));
1238+
IsNextUsingKeyword(/* is_await_using */ true)));
12291239
}
12301240
const PendingCompilationErrorHandler* pending_error_handler() const {
12311241
return pending_error_handler_;
Collapse file

‎deps/v8/test/mjsunit/harmony/for-using-of-await-using-of.js‎

Copy file name to clipboardExpand all lines: deps/v8/test/mjsunit/harmony/for-using-of-await-using-of.js
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,4 +93,6 @@ const reservedWords =
9393
for (using using of[]) {}
9494
for (using async of []) {}
9595
for (using foo of []) {}
96+
// Cursedly, `using of` is a valid binding form in C-style for loops.
97+
for (using of = null;;) break;
9698
})();

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.