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

Side by Side Diff: src/parser.cc

Issue 1308123007: [es6] conditionally ignore TDZ semantics for formals (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 3 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 unified diff | Download patch
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/parser.h" 5 #include "src/parser.h"
6 6
7 #include "src/api.h" 7 #include "src/api.h"
8 #include "src/ast.h" 8 #include "src/ast.h"
9 #include "src/ast-literal-reindexer.h" 9 #include "src/ast-literal-reindexer.h"
10 #include "src/bailout-reason.h" 10 #include "src/bailout-reason.h"
(...skipping 2024 matching lines...) Expand 10 before | Expand all | Expand 10 after
2035 // declarations to the caller's scope so we declare all locals, too. 2035 // declarations to the caller's scope so we declare all locals, too.
2036 if (declaration_scope->is_function_scope() || 2036 if (declaration_scope->is_function_scope() ||
2037 declaration_scope->is_block_scope() || 2037 declaration_scope->is_block_scope() ||
2038 declaration_scope->is_module_scope() || 2038 declaration_scope->is_module_scope() ||
2039 declaration_scope->is_script_scope() || 2039 declaration_scope->is_script_scope() ||
2040 (declaration_scope->is_eval_scope() && 2040 (declaration_scope->is_eval_scope() &&
2041 (is_strict(declaration_scope->language_mode()) || 2041 (is_strict(declaration_scope->language_mode()) ||
2042 IsLexicalVariableMode(mode)))) { 2042 IsLexicalVariableMode(mode)))) {
2043 // Declare the variable in the declaration scope. 2043 // Declare the variable in the declaration scope.
2044 var = declaration_scope->LookupLocal(name); 2044 var = declaration_scope->LookupLocal(name);
2045 bool redeclared_parameter =
2046 var != nullptr &&
2047 declaration_kind == DeclarationDescriptor::PARAMETER &&
2048 (is_strict(language_mode()) ||
2049 !declaration_scope->has_simple_parameters());
2050 if (redeclared_parameter && var->is_arguments()) {
2051 var = nullptr;
2052 redeclared_parameter = false;
2053 }
2054
2045 if (var == NULL) { 2055 if (var == NULL) {
2046 // Declare the name. 2056 // Declare the name.
2047 Variable::Kind kind = Variable::NORMAL; 2057 Variable::Kind kind = Variable::NORMAL;
2048 int declaration_group_start = -1; 2058 int declaration_group_start = -1;
2049 if (declaration->IsFunctionDeclaration()) { 2059 if (declaration->IsFunctionDeclaration()) {
2050 kind = Variable::FUNCTION; 2060 kind = Variable::FUNCTION;
2051 } else if (declaration->IsVariableDeclaration() && 2061 } else if (declaration->IsVariableDeclaration() &&
2052 declaration->AsVariableDeclaration()->is_class_declaration()) { 2062 declaration->AsVariableDeclaration()->is_class_declaration()) {
2053 kind = Variable::CLASS; 2063 kind = Variable::CLASS;
2054 declaration_group_start = 2064 declaration_group_start =
2055 declaration->AsVariableDeclaration()->declaration_group_start(); 2065 declaration->AsVariableDeclaration()->declaration_group_start();
2056 } 2066 }
2057 var = declaration_scope->DeclareLocal( 2067 var = declaration_scope->DeclareLocal(
2058 name, mode, declaration->initialization(), kind, kNotAssigned, 2068 name, mode, declaration->initialization(), kind, kNotAssigned,
2059 declaration_group_start); 2069 declaration_group_start);
2060 } else if (IsLexicalVariableMode(mode) || 2070 } else if (IsLexicalVariableMode(mode) ||
2061 IsLexicalVariableMode(var->mode()) || 2071 IsLexicalVariableMode(var->mode()) ||
2062 ((mode == CONST_LEGACY || var->mode() == CONST_LEGACY) && 2072 ((mode == CONST_LEGACY || var->mode() == CONST_LEGACY) &&
2063 !declaration_scope->is_script_scope())) { 2073 !declaration_scope->is_script_scope()) ||
2074 redeclared_parameter) {
2064 // The name was declared in this scope before; check for conflicting 2075 // The name was declared in this scope before; check for conflicting
2065 // re-declarations. We have a conflict if either of the declarations is 2076 // re-declarations. We have a conflict if either of the declarations is
2066 // not a var (in script scope, we also have to ignore legacy const for 2077 // not a var (in script scope, we also have to ignore legacy const for
2067 // compatibility). There is similar code in runtime.cc in the Declare 2078 // compatibility). There is similar code in runtime.cc in the Declare
2068 // functions. The function CheckConflictingVarDeclarations checks for 2079 // functions. The function CheckConflictingVarDeclarations checks for
2069 // var and let bindings from different scopes whereas this is a check for 2080 // var and let bindings from different scopes whereas this is a check for
2070 // conflicting declarations within the same scope. This check also covers 2081 // conflicting declarations within the same scope. This check also covers
2071 // the special case 2082 // the special case
2072 // 2083 //
2073 // function () { let x; { var x; } } 2084 // function () { let x; { var x; } }
2074 // 2085 //
2075 // because the var declaration is hoisted to the function scope where 'x' 2086 // because the var declaration is hoisted to the function scope where 'x'
2076 // is already bound. 2087 // is already bound.
2077 DCHECK(IsDeclaredVariableMode(var->mode())); 2088 DCHECK(IsDeclaredVariableMode(var->mode()));
2078 if (is_strict(language_mode()) || allow_harmony_sloppy()) { 2089 if (is_strict(language_mode()) || allow_harmony_sloppy() ||
2090 redeclared_parameter) {
2079 // In harmony we treat re-declarations as early errors. See 2091 // In harmony we treat re-declarations as early errors. See
2080 // ES5 16 for a definition of early errors. 2092 // ES5 16 for a definition of early errors.
2081 if (declaration_kind == DeclarationDescriptor::NORMAL) { 2093 if (declaration_kind == DeclarationDescriptor::NORMAL) {
2082 ParserTraits::ReportMessage(MessageTemplate::kVarRedeclaration, name); 2094 ParserTraits::ReportMessage(MessageTemplate::kVarRedeclaration, name);
2083 } else { 2095 } else {
2084 ParserTraits::ReportMessage(MessageTemplate::kParamDupe); 2096 ParserTraits::ReportMessage(MessageTemplate::kParamDupe);
2085 } 2097 }
2086 *ok = false; 2098 *ok = false;
2087 return nullptr; 2099 return nullptr;
2088 } 2100 }
(...skipping 2292 matching lines...) Expand 10 before | Expand all | Expand 10 after
4381 factory()->NewEmptyStatement(RelocInfo::kNoPosition), 4393 factory()->NewEmptyStatement(RelocInfo::kNoPosition),
4382 RelocInfo::kNoPosition); 4394 RelocInfo::kNoPosition);
4383 return if_statement; 4395 return if_statement;
4384 } 4396 }
4385 4397
4386 4398
4387 Block* Parser::BuildParameterInitializationBlock( 4399 Block* Parser::BuildParameterInitializationBlock(
4388 const ParserFormalParameters& parameters, bool* ok) { 4400 const ParserFormalParameters& parameters, bool* ok) {
4389 DCHECK(!parameters.is_simple); 4401 DCHECK(!parameters.is_simple);
4390 DCHECK(scope_->is_function_scope()); 4402 DCHECK(scope_->is_function_scope());
4403 VariableMode parameter_mode = VAR;
4404 Token::Value init_op = Token::INIT_VAR;
4405
4406 if (parameters.contains_expressions) {
4407 parameter_mode = LET;
4408 init_op = Token::INIT_LET;
4409 }
4410
4391 Block* init_block = 4411 Block* init_block =
4392 factory()->NewBlock(NULL, 1, true, RelocInfo::kNoPosition); 4412 factory()->NewBlock(NULL, 1, true, RelocInfo::kNoPosition);
4393 for (int i = 0; i < parameters.params.length(); ++i) { 4413 for (int i = 0; i < parameters.params.length(); ++i) {
4394 auto parameter = parameters.params[i]; 4414 auto parameter = parameters.params[i];
4395 DeclarationDescriptor descriptor; 4415 DeclarationDescriptor descriptor;
4396 descriptor.declaration_kind = DeclarationDescriptor::PARAMETER; 4416 descriptor.declaration_kind = DeclarationDescriptor::PARAMETER;
4397 descriptor.parser = this; 4417 descriptor.parser = this;
4398 descriptor.declaration_scope = scope_; 4418 descriptor.declaration_scope = scope_;
4399 descriptor.scope = scope_; 4419 descriptor.scope = scope_;
4400 descriptor.hoist_scope = nullptr; 4420 descriptor.hoist_scope = nullptr;
4401 descriptor.mode = LET; 4421 descriptor.mode = parameter_mode;
4402 descriptor.is_const = false; 4422 descriptor.is_const = false;
4403 descriptor.needs_init = true; 4423 descriptor.needs_init = true;
4404 descriptor.declaration_pos = parameter.pattern->position(); 4424 descriptor.declaration_pos = parameter.pattern->position();
4405 descriptor.initialization_pos = parameter.pattern->position(); 4425 descriptor.initialization_pos = parameter.pattern->position();
4406 descriptor.init_op = Token::INIT_LET; 4426 descriptor.init_op = init_op;
4407 Expression* initial_value = 4427 Expression* initial_value =
4408 factory()->NewVariableProxy(parameters.scope->parameter(i)); 4428 factory()->NewVariableProxy(parameters.scope->parameter(i));
4409 if (parameter.initializer != nullptr) { 4429 if (parameter.initializer != nullptr) {
4410 // IS_UNDEFINED($param) ? initializer : $param 4430 // IS_UNDEFINED($param) ? initializer : $param
4411 DCHECK(!parameter.is_rest); 4431 DCHECK(!parameter.is_rest);
4412 auto condition = factory()->NewCompareOperation( 4432 auto condition = factory()->NewCompareOperation(
4413 Token::EQ_STRICT, 4433 Token::EQ_STRICT,
4414 factory()->NewVariableProxy(parameters.scope->parameter(i)), 4434 factory()->NewVariableProxy(parameters.scope->parameter(i)),
4415 factory()->NewUndefinedLiteral(RelocInfo::kNoPosition), 4435 factory()->NewUndefinedLiteral(RelocInfo::kNoPosition),
4416 RelocInfo::kNoPosition); 4436 RelocInfo::kNoPosition);
4417 initial_value = factory()->NewConditional( 4437 initial_value = factory()->NewConditional(
4418 condition, parameter.initializer, initial_value, 4438 condition, parameter.initializer, initial_value,
4419 RelocInfo::kNoPosition); 4439 RelocInfo::kNoPosition);
4420 descriptor.initialization_pos = parameter.initializer->position(); 4440 descriptor.initialization_pos = parameter.initializer->position();
4421 } else if (parameter.is_rest) { 4441 } else if (parameter.is_rest) {
4442 // var $arguments_length = %_ArgumentsLength()
4422 // $rest = []; 4443 // $rest = [];
4423 // for (var $argument_index = $rest_index; 4444 // for (var $argument_index = $rest_index;
4424 // $argument_index < %_ArgumentsLength(); 4445 // $argument_index < %_ArgumentsLength();
4425 // ++$argument_index) { 4446 // ++$argument_index) {
4426 // %AppendElement($rest, %_Arguments($argument_index)); 4447 // /* TODO: use CreateDataProperty($rest, $argument_index - $rest_index,
4448 // %_Arguments($argument_index)) */
4449 // $rest[$argument_index - $rest_index] = $_Arguments($argument_index)
4427 // } 4450 // }
4428 // let <param> = $rest; 4451 // let <param> = $rest;
4429 DCHECK(parameter.pattern->IsVariableProxy()); 4452 DCHECK(parameter.pattern->IsVariableProxy());
4430 DCHECK_EQ(i, parameters.params.length() - 1); 4453 DCHECK_EQ(i, parameters.params.length() - 1);
4431 4454
4432 int pos = parameter.pattern->position(); 4455 int pos = parameter.pattern->position();
4433 Variable* temp_var = parameters.scope->parameter(i); 4456 Variable* temp_var = parameters.scope->parameter(i);
4457 Variable* arguments_length =
4458 parameters.scope->NewTemporary(ast_value_factory()->empty_string());
4459
4460 // var $arguments_length = %_ArgumentsLength();
4461 auto empty_arguments = new (zone()) ZoneList<Expression*>(0, zone());
4462 auto init_arguments_length = factory()->NewAssignment(
4463 Token::INIT_VAR, factory()->NewVariableProxy(arguments_length),
4464 factory()->NewCallRuntime(Runtime::kInlineArgumentsLength,
4465 empty_arguments, RelocInfo::kNoPosition),
4466 RelocInfo::kNoPosition);
4467
4468 // $rest = Array($arguments_length && $arguments_length - 1);
4434 auto empty_values = new (zone()) ZoneList<Expression*>(0, zone()); 4469 auto empty_values = new (zone()) ZoneList<Expression*>(0, zone());
4435 auto empty_array = factory()->NewArrayLiteral( 4470 auto empty_array = factory()->NewArrayLiteral(
4436 empty_values, parameters.rest_array_literal_index, 4471 empty_values, parameters.rest_array_literal_index,
4437 is_strong(language_mode()), RelocInfo::kNoPosition); 4472 is_strong(language_mode()), RelocInfo::kNoPosition);
4438 4473
4439 auto init_array = factory()->NewAssignment( 4474 auto init_array = factory()->NewAssignment(
4440 Token::INIT_VAR, factory()->NewVariableProxy(temp_var), empty_array, 4475 Token::INIT_VAR, factory()->NewVariableProxy(temp_var), empty_array,
4441 RelocInfo::kNoPosition); 4476 RelocInfo::kNoPosition);
4442 4477
4478
4443 auto loop = factory()->NewForStatement(NULL, RelocInfo::kNoPosition); 4479 auto loop = factory()->NewForStatement(NULL, RelocInfo::kNoPosition);
4444 4480
4445 auto argument_index = 4481 Variable* argument_index =
4446 parameters.scope->NewTemporary(ast_value_factory()->empty_string()); 4482 parameters.scope->NewTemporary(ast_value_factory()->empty_string());
4447 auto init = factory()->NewExpressionStatement( 4483 auto init = factory()->NewExpressionStatement(
4448 factory()->NewAssignment( 4484 factory()->NewAssignment(
4449 Token::INIT_VAR, factory()->NewVariableProxy(argument_index), 4485 Token::INIT_VAR, factory()->NewVariableProxy(argument_index),
4450 factory()->NewSmiLiteral(i, RelocInfo::kNoPosition), 4486 factory()->NewSmiLiteral(i, RelocInfo::kNoPosition),
4451 RelocInfo::kNoPosition), 4487 RelocInfo::kNoPosition),
4452 RelocInfo::kNoPosition); 4488 RelocInfo::kNoPosition);
4453 4489
4454 auto empty_arguments = new (zone()) ZoneList<Expression*>(0, zone());
4455
4456 // $arguments_index < arguments.length 4490 // $arguments_index < arguments.length
4457 auto cond = factory()->NewCompareOperation( 4491 auto cond = factory()->NewCompareOperation(
4458 Token::LT, factory()->NewVariableProxy(argument_index), 4492 Token::LT, factory()->NewVariableProxy(argument_index),
4459 factory()->NewCallRuntime(Runtime::kInlineArgumentsLength, 4493 factory()->NewVariableProxy(arguments_length),
4460 empty_arguments, RelocInfo::kNoPosition),
4461 RelocInfo::kNoPosition); 4494 RelocInfo::kNoPosition);
4462 4495
4463 // ++argument_index 4496 // ++argument_index
4464 auto next = factory()->NewExpressionStatement( 4497 auto next = factory()->NewExpressionStatement(
4465 factory()->NewCountOperation( 4498 factory()->NewCountOperation(
4466 Token::INC, true, factory()->NewVariableProxy(argument_index), 4499 Token::INC, true, factory()->NewVariableProxy(argument_index),
4467 RelocInfo::kNoPosition), 4500 RelocInfo::kNoPosition),
4468 RelocInfo::kNoPosition); 4501 RelocInfo::kNoPosition);
4469 4502
4470 // %_Arguments($arguments_index) 4503 // %_Arguments($arguments_index)
4471 auto arguments_args = new (zone()) ZoneList<Expression*>(1, zone()); 4504 auto arguments_args = new (zone()) ZoneList<Expression*>(1, zone());
4472 arguments_args->Add(factory()->NewVariableProxy(argument_index), zone()); 4505 arguments_args->Add(factory()->NewVariableProxy(argument_index), zone());
4473 4506
4474 // %AppendElement($rest, %_Arguments($arguments_index)) 4507 // $rest[ $arguments_index - $rest_index ] = %_Arguments($arguments_index)
4475 auto append_element_args = new (zone()) ZoneList<Expression*>(2, zone());
4476
4477 append_element_args->Add(factory()->NewVariableProxy(temp_var), zone());
4478 append_element_args->Add(
4479 factory()->NewCallRuntime(Runtime::kInlineArguments, arguments_args,
4480 RelocInfo::kNoPosition),
4481 zone());
4482
4483 auto body = factory()->NewExpressionStatement( 4508 auto body = factory()->NewExpressionStatement(
4484 factory()->NewCallRuntime(Runtime::kAppendElement, 4509 factory()->NewAssignment(
4485 append_element_args, 4510 Token::ASSIGN,
4486 RelocInfo::kNoPosition), 4511 factory()->NewProperty(
4512 factory()->NewVariableProxy(temp_var),
4513 factory()->NewBinaryOperation(
4514 Token::SUB, factory()->NewVariableProxy(argument_index),
4515 factory()->NewSmiLiteral(i, RelocInfo::kNoPosition),
4516 RelocInfo::kNoPosition),
4517 RelocInfo::kNoPosition),
4518 factory()->NewCallRuntime(Runtime::kInlineArguments,
4519 arguments_args, RelocInfo::kNoPosition),
4520 RelocInfo::kNoPosition),
4487 RelocInfo::kNoPosition); 4521 RelocInfo::kNoPosition);
4488 4522
4489 loop->Initialize(init, cond, next, body); 4523 loop->Initialize(init, cond, next, body);
4490 4524
4491 init_block->AddStatement( 4525 init_block->AddStatement(
4526 factory()->NewExpressionStatement(init_arguments_length,
4527 RelocInfo::kNoPosition),
4528 zone());
4529 init_block->AddStatement(
4492 factory()->NewExpressionStatement(init_array, RelocInfo::kNoPosition), 4530 factory()->NewExpressionStatement(init_array, RelocInfo::kNoPosition),
4493 zone()); 4531 zone());
4494 4532
4495 init_block->AddStatement(loop, zone()); 4533 init_block->AddStatement(loop, zone());
4496 4534
4497 descriptor.initialization_pos = pos; 4535 descriptor.initialization_pos = pos;
4498 } 4536 }
4499 4537
4500 Scope* param_scope = scope_; 4538 Scope* param_scope = scope_;
4501 Block* param_block = init_block; 4539 Block* param_block = init_block;
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
4553 4591
4554 // For concise constructors, check that they are constructed, 4592 // For concise constructors, check that they are constructed,
4555 // not called. 4593 // not called.
4556 if (i::IsConstructor(kind)) { 4594 if (i::IsConstructor(kind)) {
4557 AddAssertIsConstruct(result, pos); 4595 AddAssertIsConstruct(result, pos);
4558 } 4596 }
4559 4597
4560 ZoneList<Statement*>* body = result; 4598 ZoneList<Statement*>* body = result;
4561 Scope* inner_scope = scope_; 4599 Scope* inner_scope = scope_;
4562 Block* inner_block = nullptr; 4600 Block* inner_block = nullptr;
4563 if (!parameters.is_simple) { 4601 if (parameters.contains_expressions) {
4564 inner_scope = NewScope(scope_, BLOCK_SCOPE); 4602 inner_scope = NewScope(scope_, BLOCK_SCOPE);
4565 inner_scope->set_is_declaration_scope(); 4603 inner_scope->set_is_declaration_scope();
4566 inner_scope->set_start_position(scanner()->location().beg_pos); 4604 inner_scope->set_start_position(scanner()->location().beg_pos);
4567 inner_block = factory()->NewBlock(NULL, 8, true, RelocInfo::kNoPosition); 4605 inner_block = factory()->NewBlock(NULL, 8, true, RelocInfo::kNoPosition);
4568 inner_block->set_scope(inner_scope); 4606 inner_block->set_scope(inner_scope);
4569 body = inner_block->statements(); 4607 body = inner_block->statements();
4608 } else if (!parameters.is_simple) {
4609 Block* init_block = BuildParameterInitializationBlock(parameters, CHECK_OK);
4610 DCHECK_NOT_NULL(init_block);
4611 result->Add(init_block, zone());
4570 } 4612 }
4571 4613
4572 { 4614 {
4573 BlockState block_state(&scope_, inner_scope); 4615 BlockState block_state(&scope_, inner_scope);
4574 4616
4575 // For generators, allocate and yield an iterator on function entry. 4617 // For generators, allocate and yield an iterator on function entry.
4576 if (IsGeneratorFunction(kind)) { 4618 if (IsGeneratorFunction(kind)) {
4577 ZoneList<Expression*>* arguments = 4619 ZoneList<Expression*>* arguments =
4578 new(zone()) ZoneList<Expression*>(0, zone()); 4620 new(zone()) ZoneList<Expression*>(0, zone());
4579 CallRuntime* allocation = factory()->NewCallRuntime( 4621 CallRuntime* allocation = factory()->NewCallRuntime(
(...skipping 28 matching lines...) Expand all
4608 factory()->NewReturnStatement( 4650 factory()->NewReturnStatement(
4609 this->ThisExpression(scope_, factory(), RelocInfo::kNoPosition), 4651 this->ThisExpression(scope_, factory(), RelocInfo::kNoPosition),
4610 RelocInfo::kNoPosition), 4652 RelocInfo::kNoPosition),
4611 zone()); 4653 zone());
4612 } 4654 }
4613 } 4655 }
4614 4656
4615 Expect(Token::RBRACE, CHECK_OK); 4657 Expect(Token::RBRACE, CHECK_OK);
4616 scope_->set_end_position(scanner()->location().end_pos); 4658 scope_->set_end_position(scanner()->location().end_pos);
4617 4659
4618 if (!parameters.is_simple) { 4660 if (parameters.contains_expressions) {
4619 DCHECK_NOT_NULL(inner_scope); 4661 DCHECK_NOT_NULL(inner_scope);
4620 DCHECK_EQ(body, inner_block->statements()); 4662 DCHECK_EQ(body, inner_block->statements());
4663
4664 DCHECK_NE(scope_, inner_scope);
4621 scope_->SetLanguageMode(inner_scope->language_mode()); 4665 scope_->SetLanguageMode(inner_scope->language_mode());
4622 Block* init_block = BuildParameterInitializationBlock(parameters, CHECK_OK); 4666 Block* init_block = BuildParameterInitializationBlock(parameters, CHECK_OK);
4623 DCHECK_NOT_NULL(init_block); 4667 DCHECK_NOT_NULL(init_block);
4624 4668
4625 inner_scope->set_end_position(scanner()->location().end_pos); 4669 inner_scope->set_end_position(scanner()->location().end_pos);
4626 inner_scope = inner_scope->FinalizeBlockScope(); 4670 inner_scope = inner_scope->FinalizeBlockScope();
4627 if (inner_scope != nullptr) { 4671 if (inner_scope != nullptr) {
4628 CheckConflictingVarDeclarations(inner_scope, CHECK_OK); 4672 CheckConflictingVarDeclarations(inner_scope, CHECK_OK);
4629 } 4673 }
4630 4674
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
4689 SET_ALLOW(harmony_default_parameters); 4733 SET_ALLOW(harmony_default_parameters);
4690 SET_ALLOW(harmony_spreadcalls); 4734 SET_ALLOW(harmony_spreadcalls);
4691 SET_ALLOW(harmony_destructuring); 4735 SET_ALLOW(harmony_destructuring);
4692 SET_ALLOW(harmony_spread_arrays); 4736 SET_ALLOW(harmony_spread_arrays);
4693 SET_ALLOW(harmony_new_target); 4737 SET_ALLOW(harmony_new_target);
4694 SET_ALLOW(strong_mode); 4738 SET_ALLOW(strong_mode);
4695 #undef SET_ALLOW 4739 #undef SET_ALLOW
4696 } 4740 }
4697 PreParser::PreParseResult result = reusable_preparser_->PreParseLazyFunction( 4741 PreParser::PreParseResult result = reusable_preparser_->PreParseLazyFunction(
4698 language_mode(), function_state_->kind(), scope_->has_simple_parameters(), 4742 language_mode(), function_state_->kind(), scope_->has_simple_parameters(),
4699 logger, bookmark); 4743 scope_->has_parameter_expressions(), logger, bookmark);
4700 if (pre_parse_timer_ != NULL) { 4744 if (pre_parse_timer_ != NULL) {
4701 pre_parse_timer_->Stop(); 4745 pre_parse_timer_->Stop();
4702 } 4746 }
4703 return result; 4747 return result;
4704 } 4748 }
4705 4749
4706 4750
4707 ClassLiteral* Parser::ParseClassLiteral(const AstRawString* name, 4751 ClassLiteral* Parser::ParseClassLiteral(const AstRawString* name,
4708 Scanner::Location class_name_location, 4752 Scanner::Location class_name_location,
4709 bool name_is_strict_reserved, int pos, 4753 bool name_is_strict_reserved, int pos,
(...skipping 1494 matching lines...) Expand 10 before | Expand all | Expand 10 after
6204 6248
6205 Expression* Parser::SpreadCallNew(Expression* function, 6249 Expression* Parser::SpreadCallNew(Expression* function,
6206 ZoneList<v8::internal::Expression*>* args, 6250 ZoneList<v8::internal::Expression*>* args,
6207 int pos) { 6251 int pos) {
6208 args->InsertAt(0, function, zone()); 6252 args->InsertAt(0, function, zone());
6209 6253
6210 return factory()->NewCallRuntime(Context::REFLECT_CONSTRUCT_INDEX, args, pos); 6254 return factory()->NewCallRuntime(Context::REFLECT_CONSTRUCT_INDEX, args, pos);
6211 } 6255 }
6212 } // namespace internal 6256 } // namespace internal
6213 } // namespace v8 6257 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698