Bug 144280

Summary: Class name binding should be constant inside the class body
Product: WebKit Reporter: Erik Arvidsson <arv>
Component: JavaScriptCoreAssignee: 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    

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