Bug 144280
| Summary: | Class name binding should be constant inside the class body | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Erik Arvidsson <arv> |
| Component: | JavaScriptCore | Assignee: | Ryosuke Niwa <rniwa> |
| Status: | RESOLVED FIXED | ||
| Severity: | Minor | CC: | joepeck, rniwa, saam |
| Priority: | P2 | ||
| Version: | 528+ (Nightly build) | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Bug Depends on: | |||
| Bug Blocks: | 140491 | ||
Erik Arvidsson
http://trac.webkit.org/browser/trunk/LayoutTests/js/script-tests/class-syntax-name.js#L84
runTestShouldThrow("class A { constructor() { A = 1; } }; new A");
This should not throw. ClassDeclarations do not create an inner const binding. Your code seems to be doing the right thing based on the -expexted.txt
Another line to add to this test would be:
runTestShouldThrow("class A { constructor() { A = 1; } }; new A; new A");
which should throw because in the second call to `new A` A is 1.
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Erik Arvidsson
My bad. The test is right and the JSC behavior is wrong.
ng.
Ryosuke Niwa
Saam, did your patch to make class declaration block-scoped fix this?
Ryosuke Niwa
Yup, this has been fixed by http://trac.webkit.org/changeset/187680