Bug 157974
| Summary: | [JSC] incorrectly reports SyntaxError when destructuring `let` | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Caitlin Potter (:caitp) <caitp> |
| Component: | JavaScriptCore | Assignee: | Nobody <webkit-unassigned> |
| Status: | RESOLVED FIXED | ||
| Severity: | Normal | CC: | webkit-bug-importer |
| Priority: | P2 | Keywords: | EasyFix, FromImplementor, GoodFirstBug, InRadar |
| Version: | WebKit Nightly Build | ||
| Hardware: | All | ||
| OS: | Unspecified | ||
Caitlin Potter (:caitp)
Right now, the parser eagerly reports an error when parsing an ObjectPattern (with DestructuringKind::DestructureToLet), as soon as it encounters the identifier "let" is encountered, without knowing if "let" is the intended destructuring target / binding identifier or not.
Example code:
```
let {let: a} = {let: 1 }
```
This should declare a lexical variable `a` initialized to `1`, but instead reports a SyntaxError. It's just a case of reporting the error a bit too early, before it's known whether it's the binding target or not. Easy fix, good first bug :)
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
serakeri
Pull request: https://github.com/WebKit/WebKit/pull/32212
EWS
Committed 283217@main (dbcb33d932fc): <https://commits.webkit.org/283217@main>
Reviewed commits have been landed. Closing PR #32212 and removing active labels.
Radar WebKit Bug Importer
<rdar://problem/135353378>