Bug 79571

Summary: StringLiteral and NumericLiteral are allowed as ObjectLiteral getter / setter name
Product: WebKit Reporter: Yusuke Suzuki <ysuzuki>
Component: JavaScriptCoreAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: barraclough, dglazkov, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
none
Patch none

Description Yusuke Suzuki 2012-02-25 08:47:29 PST
According to ECMA262 5.1 section 11.1.5 'Object Initialiser', getter and setter name is 'PropertyName'.

    PropertyAssignment :
        PropertyName : AssignmentExpression
        get PropertyName ( ) { FunctionBody } 
        set PropertyName ( PropertySetParameterList ) { FunctionBody }

And PropertyName contains StringLiteral and NumericLiteral.

    PropertyName :
        IdentifierName
        StringLiteral
        NumericLiteral

So StringLiteral and NumericLiteral are allowed as ObjectLiteral getter / setter name.

for example,
  var obj = {
      get 42() { return 42; },
      get 'string'() { return 'string'; }
  };
is valid syntax.
Comment 1 Yusuke Suzuki 2012-02-25 08:59:12 PST
Created attachment 128869 [details]
Patch
Comment 2 WebKit Review Bot 2012-02-25 09:55:31 PST
Comment on attachment 128869 [details]
Patch

Attachment 128869 [details] did not pass chromium-ews (chromium-xvfb):
Output: http://queues.webkit.org/results/11626440

New failing tests:
fast/js/property-getters-and-setters.html
Comment 3 Yusuke Suzuki 2012-02-25 10:07:09 PST
Created attachment 128872 [details]
Patch
Comment 4 Yusuke Suzuki 2012-02-25 10:08:42 PST
Sorry, fixed variable names o9, o10 on LayoutTests property-getters-and-setters.
Comment 5 WebKit Review Bot 2012-02-25 12:45:53 PST
Comment on attachment 128872 [details]
Patch

Attachment 128872 [details] did not pass chromium-ews (chromium-xvfb):
Output: http://queues.webkit.org/results/11633409

New failing tests:
fast/js/property-getters-and-setters.html
inspector/protocol/console-agent.html
Comment 6 Gavin Barraclough 2012-02-25 20:24:08 PST
Comment on attachment 128872 [details]
Patch

Nice fix!
Comment 7 WebKit Review Bot 2012-02-26 01:28:14 PST
Comment on attachment 128872 [details]
Patch

Rejecting attachment 128872 [details] from commit-queue.

New failing tests:
fast/js/property-getters-and-setters.html
compositing/reflections/nested-reflection-transformed.html
Full output: http://queues.webkit.org/results/11628599
Comment 8 Yusuke Suzuki 2012-02-26 07:28:53 PST
Oops! I overlooked that there is LayoutTests/platform/chromium/fast/js/property-getters-and-setters-expected.txt!
So I attached revised patch soon, sorry to trouble you.
Comment 9 Yusuke Suzuki 2012-02-26 07:30:13 PST
Created attachment 128913 [details]
Patch
Comment 10 WebKit Review Bot 2012-02-26 14:49:51 PST
The commit-queue encountered the following flaky tests while processing attachment 128913 [details]:

inspector/protocol/console-agent.html bug 79563 (authors: caseq@chromium.org, loislo@chromium.org, and pfeldman@chromium.org)
The commit-queue is continuing to process your patch.
Comment 11 WebKit Review Bot 2012-02-26 14:51:52 PST
Comment on attachment 128913 [details]
Patch

Clearing flags on attachment: 128913

Committed r108935: <http://trac.webkit.org/changeset/108935>
Comment 12 WebKit Review Bot 2012-02-26 14:51:57 PST
All reviewed patches have been landed.  Closing bug.