Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(943)

Unified Diff: src/preparser.cc

Issue 160073006: Implement handling of arrow functions in the parser (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Implement handling of arrow functions in the parser Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« src/preparser.h ('K') | « src/preparser.h ('k') | src/runtime.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/preparser.cc
diff --git a/src/preparser.cc b/src/preparser.cc
index 459cb6ae8a3bd00491ff90b75a88d8b12869650b..29b5c2fe41c5ca4071a85a4ef9a28e38f0527205 100644
--- a/src/preparser.cc
+++ b/src/preparser.cc
@@ -136,13 +136,14 @@ PreParserExpression PreParserTraits::ParseFunctionLiteral(
PreParserIdentifier name,
Scanner::Location function_name_location,
bool name_is_strict_reserved,
- bool is_generator,
+ FunctionParsingMode parsing_mode,
+ PreParserExpression params_ast,
int function_token_position,
FunctionLiteral::FunctionType type,
bool* ok) {
return pre_parser_->ParseFunctionLiteral(
- name, function_name_location, name_is_strict_reserved, is_generator,
- function_token_position, type, ok);
+ name, function_name_location, name_is_strict_reserved, parsing_mode,
+ params_ast, function_token_position, type, ok);
}
@@ -355,14 +356,17 @@ PreParser::Statement PreParser::ParseFunctionDeclaration(bool* ok) {
// '{' FunctionBody '}'
Expect(Token::FUNCTION, CHECK_OK);
int pos = position();
- bool is_generator = allow_generators() && Check(Token::MUL);
+ FunctionParsingMode parsing_mode = (allow_generators() && Check(Token::MUL))
+ ? kGeneratorFunction
+ : kNormalFunction;
bool is_strict_reserved = false;
Identifier name = ParseIdentifierOrStrictReservedWord(
&is_strict_reserved, CHECK_OK);
ParseFunctionLiteral(name,
scanner()->location(),
is_strict_reserved,
- is_generator,
+ parsing_mode,
+ EmptyExpression(),
pos,
FunctionLiteral::DECLARATION,
CHECK_OK);
@@ -841,7 +845,8 @@ PreParser::Expression PreParser::ParseFunctionLiteral(
Identifier function_name,
Scanner::Location function_name_location,
bool name_is_strict_reserved,
- bool is_generator,
+ FunctionParsingMode parsing_mode,
+ PreParserExpression params_ast,
int function_token_pos,
FunctionLiteral::FunctionType function_type,
bool* ok) {
@@ -853,7 +858,7 @@ PreParser::Expression PreParser::ParseFunctionLiteral(
bool inside_with = scope_->inside_with();
PreParserScope function_scope(scope_, FUNCTION_SCOPE);
FunctionState function_state(&function_state_, &scope_, &function_scope);
- function_state.set_is_generator(is_generator);
+ function_state.set_is_generator(parsing_mode == kGeneratorFunction);
// FormalParameterList ::
// '(' (Identifier)*[','] ')'
Expect(Token::LPAREN, CHECK_OK);
« src/preparser.h ('K') | « src/preparser.h ('k') | src/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698