[Webkit-unassigned] [Bug 79571] New: StringLiteral and NumericLiteral are allowed as ObjectLiteral getter / setter name

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sat Feb 25 08:47:29 PST 2012


https://bugs.webkit.org/show_bug.cgi?id=79571

           Summary: StringLiteral and NumericLiteral are allowed as
                    ObjectLiteral getter / setter name
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: Unspecified
        OS/Version: Unspecified
            Status: UNCONFIRMED
          Severity: Normal
          Priority: P2
         Component: JavaScriptCore
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: utatane.tea at gmail.com


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.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list