Bug 147600 - JSC allows invalid var declarations when the declared name is the same as a let/const variable
Summary: JSC allows invalid var declarations when the declared name is the same as a l...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Saam Barati
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-08-03 16:47 PDT by Saam Barati
Modified: 2015-09-23 15:38 PDT (History)
9 users (show)

See Also:


Attachments
patch (33.81 KB, patch)
2015-09-23 15:02 PDT, Saam Barati
ysuzuki: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Saam Barati 2015-08-03 16:47:17 PDT
Unfortunately, this is dependent on which variable was declared first.
This should be a syntax error but isn't:
"let NAME; var NAME;"
Comment 1 Saam Barati 2015-09-23 15:02:58 PDT
Created attachment 261842 [details]
patch
Comment 2 Yusuke Suzuki 2015-09-23 15:12:24 PDT
Comment on attachment 261842 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=261842&action=review

r=me

> LayoutTests/js/script-tests/let-syntax.js:70
> +shouldNotHaveSyntaxError("function foo() { { let x; } var x; }");

Nice!

> LayoutTests/js/script-tests/let-syntax.js:105
> +shouldHaveSyntaxError("let x; var [x] = 20;");

I suggest adding `var x; let x;` cases because this issue depended on the occurrence order.
Comment 3 Saam Barati 2015-09-23 15:38:39 PDT
landed in:
http://trac.webkit.org/changeset/190188