[Webkit-unassigned] [Bug 256245] New: Improve error message for code like "var {a} = undefined; "

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue May 2 22:31:23 PDT 2023


https://bugs.webkit.org/show_bug.cgi?id=256245

            Bug ID: 256245
           Summary: Improve error message for code like "var {a} =
                    undefined;"
           Product: WebKit
           Version: WebKit Nightly Build
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: JavaScriptCore
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: jarred at jarredsumner.com

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?

-- 
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/20230503/f21ef979/attachment.htm>


More information about the webkit-unassigned mailing list