Title: [184349] trunk/Source/_javascript_Core
Revision
184349
Author
[email protected]
Date
2015-05-14 13:38:43 -0700 (Thu, 14 May 2015)

Log Message

Small refactoring before implementation of the ES6 arrow function.
https://bugs.webkit.org/show_bug.cgi?id=144954

Patch by Alexandr Skachkov <[email protected]> on 2015-05-14
Reviewed by Ryosuke Niwa.

* parser/Parser.h:
* parser/Parser.cpp:

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (184348 => 184349)


--- trunk/Source/_javascript_Core/ChangeLog	2015-05-14 20:27:56 UTC (rev 184348)
+++ trunk/Source/_javascript_Core/ChangeLog	2015-05-14 20:38:43 UTC (rev 184349)
@@ -1,3 +1,13 @@
+2015-05-14  Alexandr Skachkov  <[email protected]>
+
+        Small refactoring before implementation of the ES6 arrow function.
+        https://bugs.webkit.org/show_bug.cgi?id=144954
+
+        Reviewed by Ryosuke Niwa.
+
+        * parser/Parser.h:
+        * parser/Parser.cpp:
+
 2015-05-14  Yusuke Suzuki  <[email protected]>
 
         REGRESSION (r184337): ASSERT failed in debug builds for tagged templates

Modified: trunk/Source/_javascript_Core/parser/Parser.cpp (184348 => 184349)


--- trunk/Source/_javascript_Core/parser/Parser.cpp	2015-05-14 20:27:56 UTC (rev 184348)
+++ trunk/Source/_javascript_Core/parser/Parser.cpp	2015-05-14 20:38:43 UTC (rev 184349)
@@ -1310,15 +1310,8 @@
     return nullptr;
 }
 
-template <typename LexerType>
-template <class TreeBuilder> bool Parser<LexerType>::parseFunctionInfo(TreeBuilder& context, FunctionRequirements requirements, FunctionParseMode mode,
-    bool nameIsInContainingScope, ConstructorKind constructorKind, SuperBinding expectedSuperBinding, int functionKeywordStart, ParserFunctionInfo<TreeBuilder>& info)
+template <typename LexerType> template <class TreeBuilder> int Parser<LexerType>::parseFunctionParamters(TreeBuilder& context, FunctionRequirements requirements, FunctionParseMode mode, bool nameIsInContainingScope, AutoPopScopeRef& functionScope, ParserFunctionInfo<TreeBuilder>& info)
 {
-    AutoPopScopeRef functionScope(this, pushScope());
-    functionScope->setIsFunction();
-    int functionNameStart = m_token.m_location.startOffset;
-    const Identifier* lastFunctionName = m_lastFunctionName;
-    m_lastFunctionName = nullptr;
     if (match(IDENT)) {
         info.name = m_token.m_data.ident;
         m_lastFunctionName = info.name;
@@ -1354,6 +1347,21 @@
         }
         consumeOrFail(CLOSEPAREN, "Expected a ')' or a ',' after a parameter declaration");
     }
+    
+    return parametersStart;
+}
+    
+template <typename LexerType>
+template <class TreeBuilder> bool Parser<LexerType>::parseFunctionInfo(TreeBuilder& context, FunctionRequirements requirements, FunctionParseMode mode, bool nameIsInContainingScope, ConstructorKind constructorKind, SuperBinding expectedSuperBinding, int functionKeywordStart, ParserFunctionInfo<TreeBuilder>& info)
+{
+    AutoPopScopeRef functionScope(this, pushScope());
+    functionScope->setIsFunction();
+    int functionNameStart = m_token.m_location.startOffset;
+    const Identifier* lastFunctionName = m_lastFunctionName;
+    m_lastFunctionName = nullptr;
+    
+    int parametersStart = parseFunctionParamters(context, requirements, mode, nameIsInContainingScope, functionScope, info);
+    propagateError();
 
     matchOrFail(OPENBRACE, "Expected an opening '{' at the start of a ", stringForFunctionMode(mode), " body");
 

Modified: trunk/Source/_javascript_Core/parser/Parser.h (184348 => 184349)


--- trunk/Source/_javascript_Core/parser/Parser.h	2015-05-14 20:27:56 UTC (rev 184348)
+++ trunk/Source/_javascript_Core/parser/Parser.h	2015-05-14 20:38:43 UTC (rev 184349)
@@ -773,6 +773,9 @@
     template <class TreeBuilder> NEVER_INLINE TreeDeconstructionPattern tryParseDeconstructionPatternExpression(TreeBuilder&);
 
     template <class TreeBuilder> NEVER_INLINE bool parseFunctionInfo(TreeBuilder&, FunctionRequirements, FunctionParseMode, bool nameIsInContainingScope, ConstructorKind, SuperBinding, int functionKeywordStart, ParserFunctionInfo<TreeBuilder>&);
+    
+    template <class TreeBuilder> NEVER_INLINE int parseFunctionParamters(TreeBuilder&, FunctionRequirements, FunctionParseMode, bool, AutoPopScopeRef&, ParserFunctionInfo<TreeBuilder>&);
+
 #if ENABLE(ES6_CLASS_SYNTAX)
     template <class TreeBuilder> NEVER_INLINE TreeClassExpression parseClass(TreeBuilder&, FunctionRequirements, ParserClassInfo<TreeBuilder>&);
 #endif
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to