| Index: src/parser.cc
|
| diff --git a/src/parser.cc b/src/parser.cc
|
| index 37e265aa4a059e7530186a301ec9a48ad7b49b1e..f16bb16f69d9105cbd6f3b39b57c42edf5d247e2 100644
|
| --- a/src/parser.cc
|
| +++ b/src/parser.cc
|
| @@ -615,9 +615,8 @@ const AstRawString* ParserTraits::GetNextSymbol(Scanner* scanner) {
|
|
|
|
|
| Expression* ParserTraits::ThisExpression(
|
| - Scope* scope,
|
| - AstNodeFactory<AstConstructionVisitor>* factory) {
|
| - return factory->NewVariableProxy(scope->receiver());
|
| + Scope* scope, AstNodeFactory<AstConstructionVisitor>* factory, int pos) {
|
| + return factory->NewVariableProxy(scope->receiver(), pos);
|
| }
|
|
|
|
|
| @@ -853,19 +852,13 @@ FunctionLiteral* Parser::DoParseProgram(CompilationInfo* info,
|
| ast_value_factory_->Internalize(isolate());
|
| if (ok) {
|
| result = factory()->NewFunctionLiteral(
|
| - ast_value_factory_->empty_string(),
|
| - ast_value_factory_,
|
| - scope_,
|
| - body,
|
| + ast_value_factory_->empty_string(), ast_value_factory_, scope_, body,
|
| function_state.materialized_literal_count(),
|
| function_state.expected_property_count(),
|
| - function_state.handler_count(),
|
| - 0,
|
| + function_state.handler_count(), 0,
|
| FunctionLiteral::kNoDuplicateParameters,
|
| - FunctionLiteral::ANONYMOUS_EXPRESSION,
|
| - FunctionLiteral::kGlobalOrEval,
|
| - FunctionLiteral::kNotParenthesized,
|
| - FunctionLiteral::kNotGenerator,
|
| + FunctionLiteral::ANONYMOUS_EXPRESSION, FunctionLiteral::kGlobalOrEval,
|
| + FunctionLiteral::kNotParenthesized, FunctionLiteral::kNormalFunction,
|
| 0);
|
| result->set_ast_properties(factory()->visitor()->ast_properties());
|
| result->set_dont_optimize_reason(
|
| @@ -955,15 +948,19 @@ FunctionLiteral* Parser::ParseLazy(Utf16CharacterStream* source) {
|
| ? FunctionLiteral::ANONYMOUS_EXPRESSION
|
| : FunctionLiteral::NAMED_EXPRESSION)
|
| : FunctionLiteral::DECLARATION;
|
| + bool is_generator = shared_info->is_generator();
|
| bool ok = true;
|
| - result = ParseFunctionLiteral(raw_name,
|
| - Scanner::Location::invalid(),
|
| - false, // Strict mode name already checked.
|
| - shared_info->is_generator(),
|
| - RelocInfo::kNoPosition,
|
| - function_type,
|
| - FunctionLiteral::NORMAL_ARITY,
|
| - &ok);
|
| +
|
| + if (shared_info->is_arrow()) {
|
| + ASSERT(!is_generator);
|
| + result = reinterpret_cast<FunctionLiteral*>(ParseExpression(false, &ok));
|
| + } else {
|
| + result = ParseFunctionLiteral(raw_name, Scanner::Location::invalid(),
|
| + false, // Strict mode name already checked.
|
| + is_generator, RelocInfo::kNoPosition,
|
| + function_type,
|
| + FunctionLiteral::NORMAL_ARITY, &ok);
|
| + }
|
| // Make sure the results agree.
|
| ASSERT(ok == (result != NULL));
|
| }
|
| @@ -3564,24 +3561,14 @@ FunctionLiteral* Parser::ParseFunctionLiteral(
|
| }
|
| }
|
|
|
| - FunctionLiteral::IsGeneratorFlag generator = is_generator
|
| - ? FunctionLiteral::kIsGenerator
|
| - : FunctionLiteral::kNotGenerator;
|
| - FunctionLiteral* function_literal =
|
| - factory()->NewFunctionLiteral(function_name,
|
| - ast_value_factory_,
|
| - scope,
|
| - body,
|
| - materialized_literal_count,
|
| - expected_property_count,
|
| - handler_count,
|
| - num_parameters,
|
| - duplicate_parameters,
|
| - function_type,
|
| - FunctionLiteral::kIsFunction,
|
| - parenthesized,
|
| - generator,
|
| - pos);
|
| + FunctionLiteral::KindFlag kind = is_generator
|
| + ? FunctionLiteral::kGeneratorFunction
|
| + : FunctionLiteral::kNormalFunction;
|
| + FunctionLiteral* function_literal = factory()->NewFunctionLiteral(
|
| + function_name, ast_value_factory_, scope, body,
|
| + materialized_literal_count, expected_property_count, handler_count,
|
| + num_parameters, duplicate_parameters, function_type,
|
| + FunctionLiteral::kIsFunction, parenthesized, kind, pos);
|
| function_literal->set_function_token_position(function_token_pos);
|
| function_literal->set_ast_properties(&ast_properties);
|
| function_literal->set_dont_optimize_reason(dont_optimize_reason);
|
|
|