WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
162794
Find a way to make error messages better w.r.t arrow functions
https://bugs.webkit.org/show_bug.cgi?id=162794
Summary
Find a way to make error messages better w.r.t arrow functions
Saam Barati
Reported
2016-09-30 11:03:49 PDT
Currently, this is a hard problem, because we parse the parameters both under non-parameter production, and then under the the parameter production. If both parses fail due to an error, it's difficult to tell which error message we should use. For example: let x = (a, ...a) => {} We first parse (a, ...a) under non parameter list production. This causes an unexpected token "...". Then we parse under the parameter list rule, and it produces "duplicate parameter" error. However, in the general case, it's difficult to tell at this point which is the more legitimate error. I think to solve this, we'd want a mode to parse the parameters fully and not to bail for errors that are created in the parsing of the parameters themselves (but it would bail for parsing recursively). This means, it wouldn't bail for duplicates, etc, and then we could see if the token after such a parse is "=>", if it is, we use the error message from that parse, otherwise, we use the error message from the non-parameter parse.
Attachments
Add attachment
proposed patch, testcase, etc.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug