Bug 144280 - Class name binding should be constant inside the class body
Summary: Class name binding should be constant inside the class body
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Minor
Assignee: Ryosuke Niwa
URL:
Keywords:
Depends on:
Blocks: 140491
  Show dependency treegraph
 
Reported: 2015-04-27 15:01 PDT by Erik Arvidsson
Modified: 2015-08-05 21:12 PDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Erik Arvidsson 2015-04-27 15:01:54 PDT
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.
Comment 1 Erik Arvidsson 2015-04-27 15:05:58 PDT
My bad. The test is right and the JSC behavior is wrong.
ng.
Comment 2 Ryosuke Niwa 2015-08-04 21:48:22 PDT
Saam, did your patch to make class declaration block-scoped fix this?
Comment 3 Ryosuke Niwa 2015-08-05 21:12:54 PDT
Yup, this has been fixed by http://trac.webkit.org/changeset/187680