Bug 147600

Summary: JSC allows invalid var declarations when the declared name is the same as a let/const variable
Product: WebKit Reporter: Saam Barati <saam>
Component: JavaScriptCoreAssignee: Saam Barati <saam>
Status: RESOLVED FIXED    
Severity: Normal CC: basile_clement, benjamin, fpizlo, ggaren, mark.lam, mmirman, msaboff, oliver, ysuzuki
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
patch ysuzuki: review+

Saam Barati
Reported 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;"
Attachments
patch (33.81 KB, patch)
2015-09-23 15:02 PDT, Saam Barati
ysuzuki: review+
Saam Barati
Comment 1 2015-09-23 15:02:58 PDT
Yusuke Suzuki
Comment 2 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.
Saam Barati
Comment 3 2015-09-23 15:38:39 PDT
Note You need to log in before you can comment on or make changes to this bug.