Bug 247497 - Access of import in LHS throws unexpected `SyntaxError`
Summary: Access of import in LHS throws unexpected `SyntaxError`
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Local Build
Hardware: Mac (Apple Silicon) macOS 12
: P2 Normal
Assignee: Yusuke Suzuki
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-11-04 12:10 PDT by Kanguk Lee
Modified: 2022-11-08 17:46 PST (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kanguk Lee 2022-11-04 12:10:54 PDT
// input.js ( file.js exists in current directory)
import ( "file" + ".js" ) [ 0 ] = 0 ;
// Note: this is fine
// import ( "file.js" ) [ 0 ] = 0 ;
_____________________

Hello,

Executing the input.js using JSC throws SyntaxError, but it is expected to be terminated normally.

This bug looks similar to the bug I found yesterday: https://bugs.webkit.org/show_bug.cgi?id=247435.

However, I personally think this may not be a duplicate of Bug 247435, so please let me know if this bug is duplicated or not.

Running the input.js with JSC results in:

---
$ jsc input.js
Exception: SyntaxError: Left hand side of operator '=' must be a reference.
at input.js:1
---

while other engines behave like:

---
# V8
$ node input.js
// no error

# GraalJS
$ js input.js
// no error
---


WebKit version: 615.1.10
Comment 1 Radar WebKit Bug Importer 2022-11-07 16:22:01 PST
<rdar://problem/102064736>
Comment 2 Yusuke Suzuki 2022-11-07 22:54:47 PST
Pull request: https://github.com/WebKit/WebKit/pull/6240
Comment 3 EWS 2022-11-08 17:46:44 PST
Committed 256470@main (90b95a3284a6): <https://commits.webkit.org/256470@main>

Reviewed commits have been landed. Closing PR #6240 and removing active labels.