Title: [181419] trunk/Source/_javascript_Core
Revision
181419
Author
[email protected]
Date
2015-03-11 17:35:28 -0700 (Wed, 11 Mar 2015)

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

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (181418 => 181419)


--- trunk/Source/_javascript_Core/ChangeLog	2015-03-12 00:33:07 UTC (rev 181418)
+++ trunk/Source/_javascript_Core/ChangeLog	2015-03-12 00:35:28 UTC (rev 181419)
@@ -1,3 +1,19 @@
+2015-03-11  Ryosuke Niwa  <[email protected]>
+
+        "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:
+
 2015-03-11  Geoffrey Garen  <[email protected]>
 
         Many users of Heap::reportExtraMemory* are wrong, causing lots of memory growth

Modified: trunk/Source/_javascript_Core/parser/Keywords.table (181418 => 181419)


--- trunk/Source/_javascript_Core/parser/Keywords.table	2015-03-12 00:33:07 UTC (rev 181418)
+++ trunk/Source/_javascript_Core/parser/Keywords.table	2015-03-12 00:35:28 UTC (rev 181419)
@@ -30,7 +30,6 @@
 while		WHILE
 else		ELSE
 in		INTOKEN
-static		STATICTOKEN
 super		SUPER
 switch		SWITCH
 throw		THROW
@@ -52,6 +51,7 @@
 private         RESERVED_IF_STRICT
 protected       RESERVED_IF_STRICT
 public          RESERVED_IF_STRICT
+static          RESERVED_IF_STRICT
 yield           RESERVED_IF_STRICT
 
 @end

Modified: trunk/Source/_javascript_Core/parser/Parser.cpp (181418 => 181419)


--- trunk/Source/_javascript_Core/parser/Parser.cpp	2015-03-12 00:33:07 UTC (rev 181418)
+++ trunk/Source/_javascript_Core/parser/Parser.cpp	2015-03-12 00:35:28 UTC (rev 181419)
@@ -1491,7 +1491,8 @@
         JSTokenLocation methodLocation(tokenLocation());
         unsigned methodStart = tokenStart();
 
-        bool isStaticMethod = match(STATICTOKEN);
+        // For backwards compatibility, "static" is a non-reserved keyword in non-strict mode.
+        bool isStaticMethod = match(RESERVED_IF_STRICT) && *m_token.m_data.ident == m_vm->propertyNames->staticKeyword;
         if (isStaticMethod)
             next();
 

Modified: trunk/Source/_javascript_Core/parser/ParserTokens.h (181418 => 181419)


--- trunk/Source/_javascript_Core/parser/ParserTokens.h	2015-03-12 00:33:07 UTC (rev 181418)
+++ trunk/Source/_javascript_Core/parser/ParserTokens.h	2015-03-12 00:35:28 UTC (rev 181419)
@@ -78,12 +78,10 @@
 #if ENABLE(ES6_CLASS_SYNTAX)
     CLASSTOKEN,
     EXTENDS,
-    STATICTOKEN,
     SUPER,
 #else
     CLASSTOKEN = RESERVED,
     EXTENDS = RESERVED,
-    STATICTOKEN = RESERVED_IF_STRICT,
     SUPER = RESERVED,
 #endif
     OPENBRACE = 0,
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to