[Webkit-unassigned] [Bug 32722] New: Allow Reserved Words in Member and Call Expressions

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Dec 18 10:28:54 PST 2009


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

           Summary: Allow Reserved Words in Member and Call Expressions
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: PC
        OS/Version: Mac OS X 10.5
            Status: NEW
          Keywords: ES5
          Severity: Normal
          Priority: P2
         Component: JavaScriptCore
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: joepeck at webkit.org


Currently JavaScriptCore does not allow using reserved words as member
properties:

  jsc> var x = { 'import': 1 }
  jsc> x.import
  Exception: SyntaxError: Parse error

Other browsers seem to allow this right now. The above works in Chrome 4, FF
3.5, and Opera 10.

The Grammar rules are different. Notice that the last step is different
(IdentifierName instead of Identifier).

ES3:

  MemberExpression
    → MemberExpression . Identifier

  CallExpression
    → CallExpression . Identifier

ES5:

  MemberExpression
    → MemberExpression . IdentifierName

  CallExpression
    → CallExpression . IdentifierName


Workaround: (this is what JSON ended up doing)

  jsc> var x = { 'import': 1 };
  jsc> x['import']; // 1

-- 
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