Bug 190889 - Throw early ReferenceError for invalid AssignmentTargetType
Summary: Throw early ReferenceError for invalid AssignmentTargetType
Status: RESOLVED DUPLICATE of bug 197603
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-10-24 15:02 PDT by Leo Balter
Modified: 2019-05-05 22:09 PDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Leo Balter 2018-10-24 15:02:11 PDT
While I was working on new tests for import() I found that JSC is not throwing early ReferenceErrors described in updateexpressions and assignmentexpressions.

This commit lists some examples:

https://github.com/tc39/test262/pull/1897/commits/04d40998568e093c87a887e68029d247e126806e

The ReferenceError happens on runtime evaluation phase, it should happen in the parse phase.

Some examples using dynamic import:

```
import('')--
import('')++
++import('')
--import('')
import('') = 1
import('') *= 1
```

I also found this bug is not only for dynamic import and it's happening with other invalid AssignmentTargetTypes:

```
throw "foo"; (() => 1) = 1
```

The code above should throw a ReferenceError and not "foo".

---

This bug might be a duplicate of Bug 177218, but I didn't have time to fully review this other report, yet.
Comment 1 Ross Kirsling 2018-11-28 12:46:16 PST
Yeah, bug 177218 appears to be the general bug for "JSC lacks the notion of an early ReferenceError".
Comment 2 Ross Kirsling 2019-05-05 22:09:44 PDT

*** This bug has been marked as a duplicate of bug 197603 ***