Title: [179159] trunk/Source/_javascript_Core
Revision
179159
Author
[email protected]
Date
2015-01-26 17:14:14 -0800 (Mon, 26 Jan 2015)

Log Message

Parse a function _expression_ as a primary _expression_
https://bugs.webkit.org/show_bug.cgi?id=140908

Reviewed by Mark Lam.

Moved the code to generate an AST node for a function _expression_ from parseMemberExpression
to parsePrimaryExpression to match the ES6 specification terminology:
https://people.mozilla.org/~jorendorff/es6-draft.html#sec-primary-_expression_

There should be no behavior change from this change since parsePrimaryExpression is only
called in parseMemberExpression other than the fact failIfStackOverflow() is called.

* parser/Parser.cpp:
(JSC::Parser<LexerType>::parsePrimaryExpression):
(JSC::Parser<LexerType>::parseMemberExpression):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (179158 => 179159)


--- trunk/Source/_javascript_Core/ChangeLog	2015-01-27 00:55:26 UTC (rev 179158)
+++ trunk/Source/_javascript_Core/ChangeLog	2015-01-27 01:14:14 UTC (rev 179159)
@@ -1,3 +1,21 @@
+2015-01-26  Ryosuke Niwa  <[email protected]>
+
+        Parse a function _expression_ as a primary _expression_
+        https://bugs.webkit.org/show_bug.cgi?id=140908
+
+        Reviewed by Mark Lam.
+
+        Moved the code to generate an AST node for a function _expression_ from parseMemberExpression
+        to parsePrimaryExpression to match the ES6 specification terminology:
+        https://people.mozilla.org/~jorendorff/es6-draft.html#sec-primary-_expression_
+
+        There should be no behavior change from this change since parsePrimaryExpression is only
+        called in parseMemberExpression other than the fact failIfStackOverflow() is called.
+
+        * parser/Parser.cpp:
+        (JSC::Parser<LexerType>::parsePrimaryExpression):
+        (JSC::Parser<LexerType>::parseMemberExpression):
+
 2015-01-26  Myles C. Maxfield  <[email protected]>
 
         [iOS] [SVG -> OTF Converter] Flip the switch off on iOS

Modified: trunk/Source/_javascript_Core/parser/Parser.cpp (179158 => 179159)


--- trunk/Source/_javascript_Core/parser/Parser.cpp	2015-01-27 00:55:26 UTC (rev 179158)
+++ trunk/Source/_javascript_Core/parser/Parser.cpp	2015-01-27 01:14:14 UTC (rev 179159)
@@ -2027,6 +2027,15 @@
 {
     failIfStackOverflow();
     switch (m_token.m_type) {
+    case FUNCTION: {
+        JSTokenLocation location(tokenLocation());
+        unsigned functionKeywordStart = tokenStart();
+        next();
+        ParserFunctionInfo<TreeBuilder> info;
+        info.name = &m_vm->propertyNames->nullIdentifier;
+        failIfFalse((parseFunctionInfo(context, FunctionNoRequirements, FunctionMode, false, info)), "Cannot parse function _expression_");
+        return context.createFunctionExpr(location, info, functionKeywordStart);
+    }
     case OPENBRACE:
         if (strictMode())
             return parseStrictObjectLiteral(context);
@@ -2163,16 +2172,7 @@
         newCount++;
     }
 
-    if (match(FUNCTION)) {
-        unsigned functionKeywordStart = tokenStart();
-        location = tokenLocation();
-        next();
-        ParserFunctionInfo<TreeBuilder> info;
-        info.name = &m_vm->propertyNames->nullIdentifier;
-        failIfFalse((parseFunctionInfo(context, FunctionNoRequirements, FunctionMode, false, info)), "Cannot parse function _expression_");
-        base = context.createFunctionExpr(location, info, functionKeywordStart);
-    } else
-        base = parsePrimaryExpression(context);
+    base = parsePrimaryExpression(context);
     
     failIfFalse(base, "Cannot parse base _expression_");
     while (true) {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to