Chromium Code Reviews| Index: src/parsing/parser.cc |
| diff --git a/src/parsing/parser.cc b/src/parsing/parser.cc |
| index 8164c7d3b2cda7e9dd5af74dac0883f0ff95541e..4ab19e719ee806a3e9ab5087285b4dd6a81a79d1 100644 |
| --- a/src/parsing/parser.cc |
| +++ b/src/parsing/parser.cc |
| @@ -192,6 +192,7 @@ FunctionLiteral* Parser::DefaultConstructor(const AstRawString* name, |
| Scope* function_scope = NewScope(scope, FUNCTION_SCOPE, kind); |
| SetLanguageMode(function_scope, |
| static_cast<LanguageMode>(language_mode | STRICT)); |
| + |
|
Dan Ehrenberg
2016/06/11 01:48:57
Nit: revert whitespace change
gsathya
2016/06/11 01:54:02
Done.
|
| // Set start and end position to the same value |
| function_scope->set_start_position(pos); |
| function_scope->set_end_position(pos); |
| @@ -205,7 +206,16 @@ FunctionLiteral* Parser::DefaultConstructor(const AstRawString* name, |
| body = new (zone()) ZoneList<Statement*>(call_super ? 2 : 1, zone()); |
| if (call_super) { |
| // $super_constructor = %_GetSuperConstructor(<this-function>) |
| - // %reflect_construct($super_constructor, arguments, new.target) |
| + // %reflect_construct( |
| + // $super_constructor, InternalArray(...args), new.target) |
| + auto constructor_args_name = ast_value_factory()->empty_string(); |
| + bool is_duplicate; |
| + bool is_rest = true; |
| + bool is_optional = false; |
| + Variable* constructor_args = |
| + function_scope->DeclareParameter(constructor_args_name, TEMPORARY, |
| + is_optional, is_rest, &is_duplicate); |
| + |
| ZoneList<Expression*>* args = |
| new (zone()) ZoneList<Expression*>(2, zone()); |
| VariableProxy* this_function_proxy = scope_->NewUnresolved( |
| @@ -217,10 +227,12 @@ FunctionLiteral* Parser::DefaultConstructor(const AstRawString* name, |
| Expression* super_constructor = factory()->NewCallRuntime( |
| Runtime::kInlineGetSuperConstructor, tmp, pos); |
| args->Add(super_constructor, zone()); |
| - VariableProxy* arguments_proxy = scope_->NewUnresolved( |
| - factory(), ast_value_factory()->arguments_string(), Variable::NORMAL, |
| - pos); |
| - args->Add(arguments_proxy, zone()); |
| + Spread* spread_args = factory()->NewSpread( |
| + factory()->NewVariableProxy(constructor_args), pos, pos); |
| + ZoneList<Expression*>* spread_args_expr = |
| + new (zone()) ZoneList<Expression*>(1, zone()); |
| + spread_args_expr->Add(spread_args, zone()); |
| + args->AddAll(*PrepareSpreadArguments(spread_args_expr), zone()); |
| VariableProxy* new_target_proxy = scope_->NewUnresolved( |
| factory(), ast_value_factory()->new_target_string(), Variable::NORMAL, |
| pos); |