Bug 57295

Summary: ES5 Strict mode does not allow getter and setter for same propId
Product: WebKit Reporter: Ryan Berdeen <ryan>
Component: JavaScriptCoreAssignee: Oliver Hunt <oliver>
Status: RESOLVED FIXED    
Severity: Normal CC: oliver
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: OS X 10.6   
URL: http://static.ryanberdeen.com/share/2011/03/strict-accessor.html
Attachments:
Description Flags
Patch barraclough: review+

Description Ryan Berdeen 2011-03-28 20:08:26 PDT
In strict mode, an object literal with a getter and setter for the same property will cause WebKit to raise a syntax error.

This should be valid, but raises a syntax error due to the presence of the setter:

'use strict';
var o = {
    get x () {},
    set x () {}
};

Changing the property name for either getter or setter will eliminate the syntax error.

This behavior does not seem to follow ยง11.1.5.
Comment 1 Oliver Hunt 2011-05-01 20:00:26 PDT
Whoops, I think i left in a piece of code from when i was debugging.  Need to verify but the fix is trivial.

Please CC me on any other strict mode bugs that you find.
Comment 2 Oliver Hunt 2011-05-01 21:47:56 PDT
Created attachment 91879 [details]
Patch
Comment 3 Oliver Hunt 2011-05-01 21:52:10 PDT
Committed r85455: <http://trac.webkit.org/changeset/85455>