[Webkit-unassigned] [Bug 272524] New: Should throw syntax error for logical assignment that LHS is function call
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Thu Apr 11 06:26:07 PDT 2024
https://bugs.webkit.org/show_bug.cgi?id=272524
Bug ID: 272524
Summary: Should throw syntax error for logical assignment that
LHS is function call
Product: WebKit
Version: WebKit Local Build
Hardware: Unspecified
OS: Unspecified
Status: NEW
Severity: Normal
Priority: P2
Component: JavaScriptCore
Assignee: webkit-unassigned at lists.webkit.org
Reporter: aosukeke at gmail.com
According to the spec[1], syntax error should be thrown for logical assignment expressions that LHS is a function call.
```js
function foo() {}
foo() &&= 3;
```
According to https://commits.webkit.org/223412@main, it was intentional that JSC not throw a syntax error for this.
However, four years have passed since then, and the related specifications have not been updated. Also V8 and SpiderMonkey throw his Syntax Error.
```
$ cat ./logical-assignment-syntax-error.js
function foo() {}
foo() ??= 3;
$ eshost ./logical-assignment-syntax-error.js
#### JavaScriptCore
ReferenceError: Left side of assignment is not a reference.
#### SpiderMonkey
SyntaxError: invalid assignment left-hand side:
#### V8
SyntaxError: Invalid left-hand side in assignment
```
So I think JSC should also follow the specifications.
[1]: https://tc39.es/ecma262/#sec-assignment-operators-static-semantics-early-errors
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20240411/5aff3b4a/attachment.htm>
More information about the webkit-unassigned
mailing list