Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: e33864764ecc8c93c646bf941722e9188ad6a3e6
      
https://github.com/WebKit/WebKit/commit/e33864764ecc8c93c646bf941722e9188ad6a3e6
  Author: Sosuke Suzuki <[email protected]>
  Date:   2026-10-13 (Tue, 13 Oct 2026)

  Changed paths:
    A JSTests/stress/await-expression-on-lhs-of-exponentiation.js
    A JSTests/stress/await-identifier-reference-in-module.js
    M JSTests/test262/expectations-linux.yaml
    M JSTests/test262/expectations.yaml
    M Source/JavaScriptCore/parser/Parser.cpp

  Log Message:
  -----------
  [JSC] `await a ** b` and `await` as an identifier in a module should be 
SyntaxErrors
https://bugs.webkit.org/show_bug.cgi?id=327331

Reviewed by Yusuke Suzuki.

This patch fixes two early errors of `await`.

AwaitExpression is a UnaryExpression, so it cannot be the left side of `**`
without parentheses, like `-a ** b`. parseBinaryExpression checks this by the
leading token, which does not work for `await` since `await ** b` is valid
where `await` is an identifier. parseAwaitExpression now fails when `**`
follows its operand.

`await` is not an identifier anywhere in module code, but it was accepted as
an IdentifierReference where it is not parsed as an AwaitExpression:

    function f() { await; }
    async () => class { x = await };

Tests: JSTests/stress/await-expression-on-lhs-of-exponentiation.js
       JSTests/stress/await-identifier-reference-in-module.js

* JSTests/stress/await-expression-on-lhs-of-exponentiation.js: Added.
(shouldBe):
(shouldThrowSyntaxError):
(const.wrappers.expression.async f):
(expression.async f):
(expression):
(async expression):
(async f):
(identifier):
(field):
(const.wrappers.expression):
* JSTests/stress/await-identifier-reference-in-module.js: Added.
(shouldThrowModuleSyntaxError):
(const.wrappers.expression):
(expression):
(expression.f.g):
(expression.m):
(expression.get x):
(expression.prototype.m):
(expression.prototype.x):
(expression.x):
(expression.f):
* JSTests/test262/expectations-linux.yaml:
* JSTests/test262/expectations.yaml:
* Source/JavaScriptCore/parser/Parser.cpp:
(JSC::Parser<LexerType>::parseAwaitExpression):
(JSC::Parser<LexerType>::parsePrimaryExpression):

Canonical link: https://commits.webkit.org/323662@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to