⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 181419 in webkit


Ignore:
Timestamp:
Mar 11, 2015, 5:35:28 PM (11 years ago)
Author:
rniwa@webkit.org
Message:

"static" should not be a reserved keyword in non-strict mode even when ES6 class is enabled
https://bugs.webkit.org/show_bug.cgi?id=142600

Reviewed by Mark Lam.

Make "static" RESERVED_IF_STRICT and manually detect it in parseClass.

No new tests. This is already checked by js/reserved-words.html and js/keywords-and-reserved_words.html

  • parser/Keywords.table:
  • parser/Parser.cpp:

(JSC::Parser<LexerType>::parseClass):

  • parser/ParserTokens.h:
Location:
trunk/Source/JavaScriptCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r181411 r181419  
     12015-03-11  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        "static" should not be a reserved keyword in non-strict mode even when ES6 class is enabled
     4        https://bugs.webkit.org/show_bug.cgi?id=142600
     5
     6        Reviewed by Mark Lam.
     7
     8        Make "static" RESERVED_IF_STRICT and manually detect it in parseClass.
     9
     10        No new tests. This is already checked by js/reserved-words.html and js/keywords-and-reserved_words.html
     11
     12        * parser/Keywords.table:
     13        * parser/Parser.cpp:
     14        (JSC::Parser<LexerType>::parseClass):
     15        * parser/ParserTokens.h:
     16
    1172015-03-11  Geoffrey Garen  <ggaren@apple.com>
    218
  • trunk/Source/JavaScriptCore/parser/Keywords.table

    r178954 r181419  
    3131else            ELSE
    3232in              INTOKEN
    33 static          STATICTOKEN
    3433super           SUPER
    3534switch          SWITCH
     
    5352protected       RESERVED_IF_STRICT
    5453public          RESERVED_IF_STRICT
     54static          RESERVED_IF_STRICT
    5555yield           RESERVED_IF_STRICT
    5656
  • trunk/Source/JavaScriptCore/parser/Parser.cpp

    r181404 r181419  
    14921492        unsigned methodStart = tokenStart();
    14931493
    1494         bool isStaticMethod = match(STATICTOKEN);
     1494        // For backwards compatibility, "static" is a non-reserved keyword in non-strict mode.
     1495        bool isStaticMethod = match(RESERVED_IF_STRICT) && *m_token.m_data.ident == m_vm->propertyNames->staticKeyword;
    14951496        if (isStaticMethod)
    14961497            next();
  • trunk/Source/JavaScriptCore/parser/ParserTokens.h

    r180813 r181419  
    7979    CLASSTOKEN,
    8080    EXTENDS,
    81     STATICTOKEN,
    8281    SUPER,
    8382#else
    8483    CLASSTOKEN = RESERVED,
    8584    EXTENDS = RESERVED,
    86     STATICTOKEN = RESERVED_IF_STRICT,
    8785    SUPER = RESERVED,
    8886#endif
Note: See TracChangeset for help on using the changeset viewer.