Bug 256245
| Summary: | Improve error message for code like "var {a} = undefined;" | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Jarred Sumner <jarred> |
| Component: | JavaScriptCore | Assignee: | Nobody <webkit-unassigned> |
| Status: | NEW | ||
| Severity: | Normal | CC: | mark.lam, webkit-bug-importer, ysuzuki |
| Priority: | P2 | Keywords: | InRadar |
| Version: | WebKit Nightly Build | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
Jarred Sumner
Currently, the following code:
> await Promise.resolve(undefined).then(({default: a}) => a.true())
Produces the following messages:
> TypeError: Right side of assignment cannot be destructured
Instead, something closer to V8's message would be clearer:
> TypeError: Cannot read properties of undefined
It looks like the message is generated here:
https://github.com/WebKit/WebKit/blob/8c684cfbe8afa5cb7eea0e46408cbdd31e920ba1/Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp#L5607
It looks like the object can be at least null or undefined when this error is thrown, but it seems like most of these error messages are statically allocated which makes it harder to change them?
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Radar WebKit Bug Importer
<rdar://problem/109136179>