OLD | NEW |
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/parsing/parser.h" | 5 #include "src/parsing/parser.h" |
6 | 6 |
7 #include "src/api.h" | 7 #include "src/api.h" |
8 #include "src/ast/ast.h" | 8 #include "src/ast/ast.h" |
9 #include "src/ast/ast-expression-rewriter.h" | 9 #include "src/ast/ast-expression-rewriter.h" |
10 #include "src/ast/ast-expression-visitor.h" | 10 #include "src/ast/ast-expression-visitor.h" |
(...skipping 1045 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1056 // These two bits only need to be explicitly set because we're | 1056 // These two bits only need to be explicitly set because we're |
1057 // not passing the ScopeInfo to the Scope constructor. | 1057 // not passing the ScopeInfo to the Scope constructor. |
1058 // TODO(adamk): Remove these calls once the above NewScope call | 1058 // TODO(adamk): Remove these calls once the above NewScope call |
1059 // passes the ScopeInfo. | 1059 // passes the ScopeInfo. |
1060 if (shared_info->scope_info()->CallsEval()) { | 1060 if (shared_info->scope_info()->CallsEval()) { |
1061 scope->RecordEvalCall(); | 1061 scope->RecordEvalCall(); |
1062 } | 1062 } |
1063 SetLanguageMode(scope, shared_info->language_mode()); | 1063 SetLanguageMode(scope, shared_info->language_mode()); |
1064 | 1064 |
1065 scope->set_start_position(shared_info->start_position()); | 1065 scope->set_start_position(shared_info->start_position()); |
1066 ExpressionClassifier formals_classifier; | 1066 ExpressionClassifier formals_classifier(this); |
1067 ParserFormalParameters formals(scope); | 1067 ParserFormalParameters formals(scope); |
1068 Checkpoint checkpoint(this); | 1068 Checkpoint checkpoint(this); |
1069 { | 1069 { |
1070 // Parsing patterns as variable reference expression creates | 1070 // Parsing patterns as variable reference expression creates |
1071 // NewUnresolved references in current scope. Entrer arrow function | 1071 // NewUnresolved references in current scope. Entrer arrow function |
1072 // scope for formal parameter parsing. | 1072 // scope for formal parameter parsing. |
1073 BlockState block_state(&scope_, scope); | 1073 BlockState block_state(&scope_, scope); |
1074 if (Check(Token::LPAREN)) { | 1074 if (Check(Token::LPAREN)) { |
1075 // '(' StrictFormalParameters ')' | 1075 // '(' StrictFormalParameters ')' |
1076 ParseFormalParameterList(&formals, &formals_classifier, &ok); | 1076 ParseFormalParameterList(&formals, &formals_classifier, &ok); |
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1598 ParseClassLiteral(default_string, Scanner::Location::invalid(), | 1598 ParseClassLiteral(default_string, Scanner::Location::invalid(), |
1599 false, position(), CHECK_OK); | 1599 false, position(), CHECK_OK); |
1600 result = factory()->NewEmptyStatement(RelocInfo::kNoPosition); | 1600 result = factory()->NewEmptyStatement(RelocInfo::kNoPosition); |
1601 } else { | 1601 } else { |
1602 result = ParseClassDeclaration(&names, CHECK_OK); | 1602 result = ParseClassDeclaration(&names, CHECK_OK); |
1603 } | 1603 } |
1604 break; | 1604 break; |
1605 | 1605 |
1606 default: { | 1606 default: { |
1607 int pos = peek_position(); | 1607 int pos = peek_position(); |
1608 ExpressionClassifier classifier; | 1608 ExpressionClassifier classifier(this); |
1609 Expression* expr = ParseAssignmentExpression(true, &classifier, CHECK_OK); | 1609 Expression* expr = ParseAssignmentExpression(true, &classifier, CHECK_OK); |
1610 expr = ParserTraits::RewriteNonPattern(expr, &classifier, CHECK_OK); | 1610 RewriteNonPattern(&classifier, CHECK_OK); |
1611 | 1611 |
1612 ExpectSemicolon(CHECK_OK); | 1612 ExpectSemicolon(CHECK_OK); |
1613 result = factory()->NewExpressionStatement(expr, pos); | 1613 result = factory()->NewExpressionStatement(expr, pos); |
1614 break; | 1614 break; |
1615 } | 1615 } |
1616 } | 1616 } |
1617 | 1617 |
1618 DCHECK_LE(names.length(), 1); | 1618 DCHECK_LE(names.length(), 1); |
1619 if (names.length() == 1) { | 1619 if (names.length() == 1) { |
1620 scope_->module()->AddLocalExport(default_string, names.first(), zone(), ok); | 1620 scope_->module()->AddLocalExport(default_string, names.first(), zone(), ok); |
(...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2370 int bindings_start = peek_position(); | 2370 int bindings_start = peek_position(); |
2371 do { | 2371 do { |
2372 FuncNameInferrer::State fni_state(fni_); | 2372 FuncNameInferrer::State fni_state(fni_); |
2373 | 2373 |
2374 // Parse name. | 2374 // Parse name. |
2375 if (!first_declaration) Consume(Token::COMMA); | 2375 if (!first_declaration) Consume(Token::COMMA); |
2376 | 2376 |
2377 Expression* pattern; | 2377 Expression* pattern; |
2378 int decl_pos = peek_position(); | 2378 int decl_pos = peek_position(); |
2379 { | 2379 { |
2380 ExpressionClassifier pattern_classifier; | 2380 ExpressionClassifier pattern_classifier(this); |
2381 Token::Value next = peek(); | 2381 Token::Value next = peek(); |
2382 pattern = ParsePrimaryExpression(&pattern_classifier, CHECK_OK); | 2382 pattern = ParsePrimaryExpression(&pattern_classifier, CHECK_OK); |
2383 ValidateBindingPattern(&pattern_classifier, CHECK_OK); | 2383 ValidateBindingPattern(&pattern_classifier, CHECK_OK); |
2384 if (IsLexicalVariableMode(parsing_result->descriptor.mode)) { | 2384 if (IsLexicalVariableMode(parsing_result->descriptor.mode)) { |
2385 ValidateLetPattern(&pattern_classifier, CHECK_OK); | 2385 ValidateLetPattern(&pattern_classifier, CHECK_OK); |
2386 } | 2386 } |
2387 if (!allow_harmony_destructuring_bind() && !pattern->IsVariableProxy()) { | 2387 if (!allow_harmony_destructuring_bind() && !pattern->IsVariableProxy()) { |
2388 ReportUnexpectedToken(next); | 2388 ReportUnexpectedToken(next); |
2389 *ok = false; | 2389 *ok = false; |
2390 return nullptr; | 2390 return nullptr; |
2391 } | 2391 } |
2392 } | 2392 } |
2393 | 2393 |
2394 Scanner::Location variable_loc = scanner()->location(); | 2394 Scanner::Location variable_loc = scanner()->location(); |
2395 const AstRawString* single_name = | 2395 const AstRawString* single_name = |
2396 pattern->IsVariableProxy() ? pattern->AsVariableProxy()->raw_name() | 2396 pattern->IsVariableProxy() ? pattern->AsVariableProxy()->raw_name() |
2397 : nullptr; | 2397 : nullptr; |
2398 if (single_name != nullptr) { | 2398 if (single_name != nullptr) { |
2399 if (fni_ != NULL) fni_->PushVariableName(single_name); | 2399 if (fni_ != NULL) fni_->PushVariableName(single_name); |
2400 } | 2400 } |
2401 | 2401 |
2402 Expression* value = NULL; | 2402 Expression* value = NULL; |
2403 int initializer_position = RelocInfo::kNoPosition; | 2403 int initializer_position = RelocInfo::kNoPosition; |
2404 if (Check(Token::ASSIGN)) { | 2404 if (Check(Token::ASSIGN)) { |
2405 ExpressionClassifier classifier; | 2405 ExpressionClassifier classifier(this); |
2406 value = ParseAssignmentExpression(var_context != kForStatement, | 2406 value = ParseAssignmentExpression(var_context != kForStatement, |
2407 &classifier, CHECK_OK); | 2407 &classifier, CHECK_OK); |
2408 value = ParserTraits::RewriteNonPattern(value, &classifier, CHECK_OK); | 2408 RewriteNonPattern(&classifier, CHECK_OK); |
2409 variable_loc.end_pos = scanner()->location().end_pos; | 2409 variable_loc.end_pos = scanner()->location().end_pos; |
2410 | 2410 |
2411 if (!parsing_result->first_initializer_loc.IsValid()) { | 2411 if (!parsing_result->first_initializer_loc.IsValid()) { |
2412 parsing_result->first_initializer_loc = variable_loc; | 2412 parsing_result->first_initializer_loc = variable_loc; |
2413 } | 2413 } |
2414 | 2414 |
2415 // Don't infer if it is "a = function(){...}();"-like expression. | 2415 // Don't infer if it is "a = function(){...}();"-like expression. |
2416 if (single_name) { | 2416 if (single_name) { |
2417 if (fni_ != NULL && value->AsCall() == NULL && | 2417 if (fni_ != NULL && value->AsCall() == NULL && |
2418 value->AsCallNew() == NULL) { | 2418 value->AsCallNew() == NULL) { |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2514 return nullptr; | 2514 return nullptr; |
2515 | 2515 |
2516 case Token::THIS: | 2516 case Token::THIS: |
2517 if (!FLAG_strong_this) break; | 2517 if (!FLAG_strong_this) break; |
2518 // Fall through. | 2518 // Fall through. |
2519 case Token::SUPER: | 2519 case Token::SUPER: |
2520 if (is_strong(language_mode()) && | 2520 if (is_strong(language_mode()) && |
2521 IsClassConstructor(function_state_->kind())) { | 2521 IsClassConstructor(function_state_->kind())) { |
2522 bool is_this = peek() == Token::THIS; | 2522 bool is_this = peek() == Token::THIS; |
2523 Expression* expr; | 2523 Expression* expr; |
2524 ExpressionClassifier classifier; | 2524 ExpressionClassifier classifier(this); |
2525 if (is_this) { | 2525 if (is_this) { |
2526 expr = ParseStrongInitializationExpression(&classifier, CHECK_OK); | 2526 expr = ParseStrongInitializationExpression(&classifier, CHECK_OK); |
2527 } else { | 2527 } else { |
2528 expr = ParseStrongSuperCallExpression(&classifier, CHECK_OK); | 2528 expr = ParseStrongSuperCallExpression(&classifier, CHECK_OK); |
2529 } | 2529 } |
2530 expr = ParserTraits::RewriteNonPattern(expr, &classifier, CHECK_OK); | 2530 RewriteNonPattern(&classifier, CHECK_OK); |
2531 switch (peek()) { | 2531 switch (peek()) { |
2532 case Token::SEMICOLON: | 2532 case Token::SEMICOLON: |
2533 Consume(Token::SEMICOLON); | 2533 Consume(Token::SEMICOLON); |
2534 break; | 2534 break; |
2535 case Token::RBRACE: | 2535 case Token::RBRACE: |
2536 case Token::EOS: | 2536 case Token::EOS: |
2537 break; | 2537 break; |
2538 default: | 2538 default: |
2539 if (!scanner()->HasAnyLineTerminatorBeforeNext()) { | 2539 if (!scanner()->HasAnyLineTerminatorBeforeNext()) { |
2540 ReportMessageAt(function_state_->this_location(), | 2540 ReportMessageAt(function_state_->this_location(), |
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3053 Variable* catch_variable = NULL; | 3053 Variable* catch_variable = NULL; |
3054 Block* catch_block = NULL; | 3054 Block* catch_block = NULL; |
3055 List<Expression*> expressions_in_tail_position_in_catch_block; | 3055 List<Expression*> expressions_in_tail_position_in_catch_block; |
3056 if (tok == Token::CATCH) { | 3056 if (tok == Token::CATCH) { |
3057 Consume(Token::CATCH); | 3057 Consume(Token::CATCH); |
3058 | 3058 |
3059 Expect(Token::LPAREN, CHECK_OK); | 3059 Expect(Token::LPAREN, CHECK_OK); |
3060 catch_scope = NewScope(scope_, CATCH_SCOPE); | 3060 catch_scope = NewScope(scope_, CATCH_SCOPE); |
3061 catch_scope->set_start_position(scanner()->location().beg_pos); | 3061 catch_scope->set_start_position(scanner()->location().beg_pos); |
3062 | 3062 |
3063 ExpressionClassifier pattern_classifier; | 3063 ExpressionClassifier pattern_classifier(this); |
3064 Expression* pattern = ParsePrimaryExpression(&pattern_classifier, CHECK_OK); | 3064 Expression* pattern = ParsePrimaryExpression(&pattern_classifier, CHECK_OK); |
3065 ValidateBindingPattern(&pattern_classifier, CHECK_OK); | 3065 ValidateBindingPattern(&pattern_classifier, CHECK_OK); |
3066 | 3066 |
3067 const AstRawString* name = ast_value_factory()->dot_catch_string(); | 3067 const AstRawString* name = ast_value_factory()->dot_catch_string(); |
3068 bool is_simple = pattern->IsVariableProxy(); | 3068 bool is_simple = pattern->IsVariableProxy(); |
3069 if (is_simple) { | 3069 if (is_simple) { |
3070 auto proxy = pattern->AsVariableProxy(); | 3070 auto proxy = pattern->AsVariableProxy(); |
3071 scope_->RemoveUnresolved(proxy); | 3071 scope_->RemoveUnresolved(proxy); |
3072 name = proxy->raw_name(); | 3072 name = proxy->raw_name(); |
3073 } | 3073 } |
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3683 // } | 3683 // } |
3684 | 3684 |
3685 Variable* temp = | 3685 Variable* temp = |
3686 scope_->NewTemporary(ast_value_factory()->dot_for_string()); | 3686 scope_->NewTemporary(ast_value_factory()->dot_for_string()); |
3687 ForEachStatement* loop = | 3687 ForEachStatement* loop = |
3688 factory()->NewForEachStatement(mode, labels, stmt_pos); | 3688 factory()->NewForEachStatement(mode, labels, stmt_pos); |
3689 Target target(&this->target_stack_, loop); | 3689 Target target(&this->target_stack_, loop); |
3690 | 3690 |
3691 Expression* enumerable; | 3691 Expression* enumerable; |
3692 if (mode == ForEachStatement::ITERATE) { | 3692 if (mode == ForEachStatement::ITERATE) { |
3693 ExpressionClassifier classifier; | 3693 ExpressionClassifier classifier(this); |
3694 enumerable = ParseAssignmentExpression(true, &classifier, CHECK_OK); | 3694 enumerable = ParseAssignmentExpression(true, &classifier, CHECK_OK); |
3695 enumerable = ParserTraits::RewriteNonPattern(enumerable, &classifier, | 3695 RewriteNonPattern(&classifier, CHECK_OK); |
3696 CHECK_OK); | |
3697 } else { | 3696 } else { |
3698 enumerable = ParseExpression(true, CHECK_OK); | 3697 enumerable = ParseExpression(true, CHECK_OK); |
3699 } | 3698 } |
3700 | 3699 |
3701 Expect(Token::RPAREN, CHECK_OK); | 3700 Expect(Token::RPAREN, CHECK_OK); |
3702 | 3701 |
3703 Scope* body_scope = NewScope(scope_, BLOCK_SCOPE); | 3702 Scope* body_scope = NewScope(scope_, BLOCK_SCOPE); |
3704 body_scope->set_start_position(scanner()->location().beg_pos); | 3703 body_scope->set_start_position(scanner()->location().beg_pos); |
3705 | 3704 |
3706 Block* body_block = | 3705 Block* body_block = |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3776 } | 3775 } |
3777 } else { | 3776 } else { |
3778 init = parsing_result.BuildInitializationBlock( | 3777 init = parsing_result.BuildInitializationBlock( |
3779 IsLexicalVariableMode(parsing_result.descriptor.mode) | 3778 IsLexicalVariableMode(parsing_result.descriptor.mode) |
3780 ? &lexical_bindings | 3779 ? &lexical_bindings |
3781 : nullptr, | 3780 : nullptr, |
3782 CHECK_OK); | 3781 CHECK_OK); |
3783 } | 3782 } |
3784 } else { | 3783 } else { |
3785 int lhs_beg_pos = peek_position(); | 3784 int lhs_beg_pos = peek_position(); |
3786 ExpressionClassifier classifier; | 3785 ExpressionClassifier classifier(this); |
3787 Expression* expression = ParseExpression(false, &classifier, CHECK_OK); | 3786 Expression* expression = ParseExpression(false, &classifier, CHECK_OK); |
3788 int lhs_end_pos = scanner()->location().end_pos; | 3787 int lhs_end_pos = scanner()->location().end_pos; |
3789 ForEachStatement::VisitMode mode; | 3788 ForEachStatement::VisitMode mode; |
3790 is_let_identifier_expression = | 3789 is_let_identifier_expression = |
3791 expression->IsVariableProxy() && | 3790 expression->IsVariableProxy() && |
3792 expression->AsVariableProxy()->raw_name() == | 3791 expression->AsVariableProxy()->raw_name() == |
3793 ast_value_factory()->let_string(); | 3792 ast_value_factory()->let_string(); |
3794 | 3793 |
3795 bool is_for_each = CheckInOrOf(&mode, ok); | 3794 bool is_for_each = CheckInOrOf(&mode, ok); |
3796 if (!*ok) return nullptr; | 3795 if (!*ok) return nullptr; |
3797 bool is_destructuring = | 3796 bool is_destructuring = |
3798 is_for_each && allow_harmony_destructuring_assignment() && | 3797 is_for_each && allow_harmony_destructuring_assignment() && |
3799 (expression->IsArrayLiteral() || expression->IsObjectLiteral()); | 3798 (expression->IsArrayLiteral() || expression->IsObjectLiteral()); |
3800 | 3799 |
3801 if (is_destructuring) { | 3800 if (is_destructuring) { |
3802 ValidateAssignmentPattern(&classifier, CHECK_OK); | 3801 ValidateAssignmentPattern(&classifier, CHECK_OK); |
3803 } else { | 3802 } else { |
3804 expression = | 3803 RewriteNonPattern(&classifier, CHECK_OK); |
3805 ParserTraits::RewriteNonPattern(expression, &classifier, CHECK_OK); | |
3806 } | 3804 } |
3807 | 3805 |
3808 if (is_for_each) { | 3806 if (is_for_each) { |
3809 if (!is_destructuring) { | 3807 if (!is_destructuring) { |
3810 expression = this->CheckAndRewriteReferenceExpression( | 3808 expression = this->CheckAndRewriteReferenceExpression( |
3811 expression, lhs_beg_pos, lhs_end_pos, | 3809 expression, lhs_beg_pos, lhs_end_pos, |
3812 MessageTemplate::kInvalidLhsInFor, kSyntaxError, CHECK_OK); | 3810 MessageTemplate::kInvalidLhsInFor, kSyntaxError, CHECK_OK); |
3813 } | 3811 } |
3814 | 3812 |
3815 ForEachStatement* loop = | 3813 ForEachStatement* loop = |
3816 factory()->NewForEachStatement(mode, labels, stmt_pos); | 3814 factory()->NewForEachStatement(mode, labels, stmt_pos); |
3817 Target target(&this->target_stack_, loop); | 3815 Target target(&this->target_stack_, loop); |
3818 | 3816 |
3819 Expression* enumerable; | 3817 Expression* enumerable; |
3820 if (mode == ForEachStatement::ITERATE) { | 3818 if (mode == ForEachStatement::ITERATE) { |
3821 ExpressionClassifier classifier; | 3819 ExpressionClassifier classifier(this); |
3822 enumerable = ParseAssignmentExpression(true, &classifier, CHECK_OK); | 3820 enumerable = ParseAssignmentExpression(true, &classifier, CHECK_OK); |
3823 enumerable = ParserTraits::RewriteNonPattern(enumerable, &classifier, | 3821 RewriteNonPattern(&classifier, CHECK_OK); |
3824 CHECK_OK); | |
3825 } else { | 3822 } else { |
3826 enumerable = ParseExpression(true, CHECK_OK); | 3823 enumerable = ParseExpression(true, CHECK_OK); |
3827 } | 3824 } |
3828 | 3825 |
3829 Expect(Token::RPAREN, CHECK_OK); | 3826 Expect(Token::RPAREN, CHECK_OK); |
3830 | 3827 |
3831 // Make a block around the statement in case a lexical binding | 3828 // Make a block around the statement in case a lexical binding |
3832 // is introduced, e.g. by a FunctionDeclaration. | 3829 // is introduced, e.g. by a FunctionDeclaration. |
3833 // This block must not use for_scope as its scope because if a | 3830 // This block must not use for_scope as its scope because if a |
3834 // lexical binding is introduced which overlaps with the for-in/of, | 3831 // lexical binding is introduced which overlaps with the for-in/of, |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4106 | 4103 |
4107 void ParserTraits::ParseArrowFunctionFormalParameterList( | 4104 void ParserTraits::ParseArrowFunctionFormalParameterList( |
4108 ParserFormalParameters* parameters, Expression* expr, | 4105 ParserFormalParameters* parameters, Expression* expr, |
4109 const Scanner::Location& params_loc, | 4106 const Scanner::Location& params_loc, |
4110 Scanner::Location* duplicate_loc, bool* ok) { | 4107 Scanner::Location* duplicate_loc, bool* ok) { |
4111 if (expr->IsEmptyParentheses()) return; | 4108 if (expr->IsEmptyParentheses()) return; |
4112 | 4109 |
4113 ParseArrowFunctionFormalParameters(parameters, expr, params_loc, ok); | 4110 ParseArrowFunctionFormalParameters(parameters, expr, params_loc, ok); |
4114 if (!*ok) return; | 4111 if (!*ok) return; |
4115 | 4112 |
4116 ExpressionClassifier classifier; | 4113 Type::ExpressionClassifier classifier(parser_); |
4117 if (!parameters->is_simple) { | 4114 if (!parameters->is_simple) { |
4118 classifier.RecordNonSimpleParameter(); | 4115 classifier.RecordNonSimpleParameter(); |
4119 } | 4116 } |
4120 for (int i = 0; i < parameters->Arity(); ++i) { | 4117 for (int i = 0; i < parameters->Arity(); ++i) { |
4121 auto parameter = parameters->at(i); | 4118 auto parameter = parameters->at(i); |
4122 DeclareFormalParameter(parameters->scope, parameter, &classifier); | 4119 DeclareFormalParameter(parameters->scope, parameter, &classifier); |
4123 if (!duplicate_loc->IsValid()) { | 4120 if (!duplicate_loc->IsValid()) { |
4124 *duplicate_loc = classifier.duplicate_formal_parameter_error().location; | 4121 *duplicate_loc = classifier.duplicate_formal_parameter_error().location; |
4125 } | 4122 } |
4126 } | 4123 } |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4207 (original_scope_ == original_declaration_scope || | 4204 (original_scope_ == original_declaration_scope || |
4208 declaration_scope != original_declaration_scope) | 4205 declaration_scope != original_declaration_scope) |
4209 ? NewScope(declaration_scope, FUNCTION_SCOPE, kind) | 4206 ? NewScope(declaration_scope, FUNCTION_SCOPE, kind) |
4210 : NewScope(scope_, FUNCTION_SCOPE, kind); | 4207 : NewScope(scope_, FUNCTION_SCOPE, kind); |
4211 SetLanguageMode(scope, language_mode); | 4208 SetLanguageMode(scope, language_mode); |
4212 ZoneList<Statement*>* body = NULL; | 4209 ZoneList<Statement*>* body = NULL; |
4213 int arity = -1; | 4210 int arity = -1; |
4214 int materialized_literal_count = -1; | 4211 int materialized_literal_count = -1; |
4215 int expected_property_count = -1; | 4212 int expected_property_count = -1; |
4216 DuplicateFinder duplicate_finder(scanner()->unicode_cache()); | 4213 DuplicateFinder duplicate_finder(scanner()->unicode_cache()); |
4217 ExpressionClassifier formals_classifier(&duplicate_finder); | |
4218 FunctionLiteral::EagerCompileHint eager_compile_hint = | 4214 FunctionLiteral::EagerCompileHint eager_compile_hint = |
4219 parenthesized_function_ ? FunctionLiteral::kShouldEagerCompile | 4215 parenthesized_function_ ? FunctionLiteral::kShouldEagerCompile |
4220 : FunctionLiteral::kShouldLazyCompile; | 4216 : FunctionLiteral::kShouldLazyCompile; |
4221 bool should_be_used_once_hint = false; | 4217 bool should_be_used_once_hint = false; |
| 4218 bool has_duplicate_parameters; |
4222 // Parse function. | 4219 // Parse function. |
4223 { | 4220 { |
4224 AstNodeFactory function_factory(ast_value_factory()); | 4221 AstNodeFactory function_factory(ast_value_factory()); |
4225 FunctionState function_state(&function_state_, &scope_, scope, kind, | 4222 FunctionState function_state(&function_state_, &scope_, scope, kind, |
4226 &function_factory); | 4223 &function_factory); |
4227 scope_->SetScopeName(function_name); | 4224 scope_->SetScopeName(function_name); |
| 4225 ExpressionClassifier formals_classifier(this, &duplicate_finder); |
4228 | 4226 |
4229 if (is_generator) { | 4227 if (is_generator) { |
4230 // For generators, allocating variables in contexts is currently a win | 4228 // For generators, allocating variables in contexts is currently a win |
4231 // because it minimizes the work needed to suspend and resume an | 4229 // because it minimizes the work needed to suspend and resume an |
4232 // activation. | 4230 // activation. |
4233 scope_->ForceContextAllocation(); | 4231 scope_->ForceContextAllocation(); |
4234 | 4232 |
4235 // Calling a generator returns a generator object. That object is stored | 4233 // Calling a generator returns a generator object. That object is stored |
4236 // in a temporary variable, a definition that is used by "yield" | 4234 // in a temporary variable, a definition that is used by "yield" |
4237 // expressions. This also marks the FunctionState as a generator. | 4235 // expressions. This also marks the FunctionState as a generator. |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4395 } | 4393 } |
4396 if (is_strict(language_mode) || allow_harmony_sloppy() || | 4394 if (is_strict(language_mode) || allow_harmony_sloppy() || |
4397 allow_harmony_destructuring_bind()) { | 4395 allow_harmony_destructuring_bind()) { |
4398 CheckConflictingVarDeclarations(scope, CHECK_OK); | 4396 CheckConflictingVarDeclarations(scope, CHECK_OK); |
4399 } | 4397 } |
4400 | 4398 |
4401 if (body) { | 4399 if (body) { |
4402 // If body can be inspected, rewrite queued destructuring assignments | 4400 // If body can be inspected, rewrite queued destructuring assignments |
4403 ParserTraits::RewriteDestructuringAssignments(); | 4401 ParserTraits::RewriteDestructuringAssignments(); |
4404 } | 4402 } |
| 4403 has_duplicate_parameters = |
| 4404 !formals_classifier.is_valid_formal_parameter_list_without_duplicates(); |
4405 } | 4405 } |
4406 | 4406 |
4407 bool has_duplicate_parameters = | |
4408 !formals_classifier.is_valid_formal_parameter_list_without_duplicates(); | |
4409 FunctionLiteral::ParameterFlag duplicate_parameters = | 4407 FunctionLiteral::ParameterFlag duplicate_parameters = |
4410 has_duplicate_parameters ? FunctionLiteral::kHasDuplicateParameters | 4408 has_duplicate_parameters ? FunctionLiteral::kHasDuplicateParameters |
4411 : FunctionLiteral::kNoDuplicateParameters; | 4409 : FunctionLiteral::kNoDuplicateParameters; |
4412 | 4410 |
4413 FunctionLiteral* function_literal = factory()->NewFunctionLiteral( | 4411 FunctionLiteral* function_literal = factory()->NewFunctionLiteral( |
4414 function_name, scope, body, materialized_literal_count, | 4412 function_name, scope, body, materialized_literal_count, |
4415 expected_property_count, arity, duplicate_parameters, function_type, | 4413 expected_property_count, arity, duplicate_parameters, function_type, |
4416 eager_compile_hint, kind, pos); | 4414 eager_compile_hint, kind, pos); |
4417 function_literal->set_function_token_position(function_token_pos); | 4415 function_literal->set_function_token_position(function_token_pos); |
4418 if (should_be_used_once_hint) | 4416 if (should_be_used_once_hint) |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4532 class InitializerRewriter : public AstExpressionVisitor { | 4530 class InitializerRewriter : public AstExpressionVisitor { |
4533 public: | 4531 public: |
4534 InitializerRewriter(uintptr_t stack_limit, Expression* root, Parser* parser, | 4532 InitializerRewriter(uintptr_t stack_limit, Expression* root, Parser* parser, |
4535 Scope* scope) | 4533 Scope* scope) |
4536 : AstExpressionVisitor(stack_limit, root), | 4534 : AstExpressionVisitor(stack_limit, root), |
4537 parser_(parser), | 4535 parser_(parser), |
4538 scope_(scope) {} | 4536 scope_(scope) {} |
4539 | 4537 |
4540 private: | 4538 private: |
4541 void VisitExpression(Expression* expr) { | 4539 void VisitExpression(Expression* expr) { |
4542 RewritableAssignmentExpression* to_rewrite = | 4540 RewritableExpression* to_rewrite = expr->AsRewritableExpression(); |
4543 expr->AsRewritableAssignmentExpression(); | |
4544 if (to_rewrite == nullptr || to_rewrite->is_rewritten()) return; | 4541 if (to_rewrite == nullptr || to_rewrite->is_rewritten()) return; |
4545 | 4542 |
4546 Parser::PatternRewriter::RewriteDestructuringAssignment(parser_, to_rewrite, | 4543 Parser::PatternRewriter::RewriteDestructuringAssignment(parser_, to_rewrite, |
4547 scope_); | 4544 scope_); |
4548 } | 4545 } |
4549 | 4546 |
4550 private: | 4547 private: |
4551 Parser* parser_; | 4548 Parser* parser_; |
4552 Scope* scope_; | 4549 Scope* scope_; |
4553 }; | 4550 }; |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4875 if (name != NULL) { | 4872 if (name != NULL) { |
4876 proxy = NewUnresolved(name, CONST); | 4873 proxy = NewUnresolved(name, CONST); |
4877 Declaration* declaration = | 4874 Declaration* declaration = |
4878 factory()->NewVariableDeclaration(proxy, CONST, block_scope, pos); | 4875 factory()->NewVariableDeclaration(proxy, CONST, block_scope, pos); |
4879 Declare(declaration, DeclarationDescriptor::NORMAL, true, CHECK_OK); | 4876 Declare(declaration, DeclarationDescriptor::NORMAL, true, CHECK_OK); |
4880 } | 4877 } |
4881 | 4878 |
4882 Expression* extends = NULL; | 4879 Expression* extends = NULL; |
4883 if (Check(Token::EXTENDS)) { | 4880 if (Check(Token::EXTENDS)) { |
4884 block_scope->set_start_position(scanner()->location().end_pos); | 4881 block_scope->set_start_position(scanner()->location().end_pos); |
4885 ExpressionClassifier classifier; | 4882 ExpressionClassifier classifier(this); |
4886 extends = ParseLeftHandSideExpression(&classifier, CHECK_OK); | 4883 extends = ParseLeftHandSideExpression(&classifier, CHECK_OK); |
4887 extends = ParserTraits::RewriteNonPattern(extends, &classifier, CHECK_OK); | 4884 RewriteNonPattern(&classifier, CHECK_OK); |
4888 } else { | 4885 } else { |
4889 block_scope->set_start_position(scanner()->location().end_pos); | 4886 block_scope->set_start_position(scanner()->location().end_pos); |
4890 } | 4887 } |
4891 | 4888 |
4892 | 4889 |
4893 ClassLiteralChecker checker(this); | 4890 ClassLiteralChecker checker(this); |
4894 ZoneList<ObjectLiteral::Property*>* properties = NewPropertyList(4, zone()); | 4891 ZoneList<ObjectLiteral::Property*>* properties = NewPropertyList(4, zone()); |
4895 FunctionLiteral* constructor = NULL; | 4892 FunctionLiteral* constructor = NULL; |
4896 bool has_seen_constructor = false; | 4893 bool has_seen_constructor = false; |
4897 | 4894 |
4898 Expect(Token::LBRACE, CHECK_OK); | 4895 Expect(Token::LBRACE, CHECK_OK); |
4899 | 4896 |
4900 const bool has_extends = extends != nullptr; | 4897 const bool has_extends = extends != nullptr; |
4901 while (peek() != Token::RBRACE) { | 4898 while (peek() != Token::RBRACE) { |
4902 if (Check(Token::SEMICOLON)) continue; | 4899 if (Check(Token::SEMICOLON)) continue; |
4903 FuncNameInferrer::State fni_state(fni_); | 4900 FuncNameInferrer::State fni_state(fni_); |
4904 const bool in_class = true; | 4901 const bool in_class = true; |
4905 const bool is_static = false; | 4902 const bool is_static = false; |
4906 bool is_computed_name = false; // Classes do not care about computed | 4903 bool is_computed_name = false; // Classes do not care about computed |
4907 // property names here. | 4904 // property names here. |
4908 ExpressionClassifier classifier; | 4905 ExpressionClassifier classifier(this); |
4909 const AstRawString* property_name = nullptr; | 4906 const AstRawString* property_name = nullptr; |
4910 ObjectLiteral::Property* property = ParsePropertyDefinition( | 4907 ObjectLiteral::Property* property = ParsePropertyDefinition( |
4911 &checker, in_class, has_extends, is_static, &is_computed_name, | 4908 &checker, in_class, has_extends, is_static, &is_computed_name, |
4912 &has_seen_constructor, &classifier, &property_name, CHECK_OK); | 4909 &has_seen_constructor, &classifier, &property_name, CHECK_OK); |
4913 property = ParserTraits::RewriteNonPatternObjectLiteralProperty( | 4910 RewriteNonPattern(&classifier, CHECK_OK); |
4914 property, &classifier, CHECK_OK); | |
4915 | 4911 |
4916 if (has_seen_constructor && constructor == NULL) { | 4912 if (has_seen_constructor && constructor == NULL) { |
4917 constructor = GetPropertyValue(property)->AsFunctionLiteral(); | 4913 constructor = GetPropertyValue(property)->AsFunctionLiteral(); |
4918 DCHECK_NOT_NULL(constructor); | 4914 DCHECK_NOT_NULL(constructor); |
4919 constructor->set_raw_name( | 4915 constructor->set_raw_name( |
4920 name != nullptr ? name : ast_value_factory()->empty_string()); | 4916 name != nullptr ? name : ast_value_factory()->empty_string()); |
4921 } else { | 4917 } else { |
4922 properties->Add(property, zone()); | 4918 properties->Add(property, zone()); |
4923 } | 4919 } |
4924 | 4920 |
(...skipping 30 matching lines...) Expand all Loading... |
4955 Expression* Parser::ParseV8Intrinsic(bool* ok) { | 4951 Expression* Parser::ParseV8Intrinsic(bool* ok) { |
4956 // CallRuntime :: | 4952 // CallRuntime :: |
4957 // '%' Identifier Arguments | 4953 // '%' Identifier Arguments |
4958 | 4954 |
4959 int pos = peek_position(); | 4955 int pos = peek_position(); |
4960 Expect(Token::MOD, CHECK_OK); | 4956 Expect(Token::MOD, CHECK_OK); |
4961 // Allow "eval" or "arguments" for backward compatibility. | 4957 // Allow "eval" or "arguments" for backward compatibility. |
4962 const AstRawString* name = ParseIdentifier(kAllowRestrictedIdentifiers, | 4958 const AstRawString* name = ParseIdentifier(kAllowRestrictedIdentifiers, |
4963 CHECK_OK); | 4959 CHECK_OK); |
4964 Scanner::Location spread_pos; | 4960 Scanner::Location spread_pos; |
4965 ExpressionClassifier classifier; | 4961 ExpressionClassifier classifier(this); |
4966 ZoneList<Expression*>* args = | 4962 ZoneList<Expression*>* args = |
4967 ParseArguments(&spread_pos, &classifier, CHECK_OK); | 4963 ParseArguments(&spread_pos, &classifier, CHECK_OK); |
4968 | 4964 |
4969 DCHECK(!spread_pos.IsValid()); | 4965 DCHECK(!spread_pos.IsValid()); |
4970 | 4966 |
4971 if (extension_ != NULL) { | 4967 if (extension_ != NULL) { |
4972 // The extension structures are only accessible while parsing the | 4968 // The extension structures are only accessible while parsing the |
4973 // very first time not when reparsing because of lazy compilation. | 4969 // very first time not when reparsing because of lazy compilation. |
4974 scope_->DeclarationScope()->ForceEagerCompilation(); | 4970 scope_->DeclarationScope()->ForceEagerCompilation(); |
4975 } | 4971 } |
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5526 SetLanguageMode(scope_, | 5522 SetLanguageMode(scope_, |
5527 static_cast<LanguageMode>(scope_->language_mode() | mode)); | 5523 static_cast<LanguageMode>(scope_->language_mode() | mode)); |
5528 } | 5524 } |
5529 | 5525 |
5530 | 5526 |
5531 void ParserTraits::RewriteDestructuringAssignments() { | 5527 void ParserTraits::RewriteDestructuringAssignments() { |
5532 parser_->RewriteDestructuringAssignments(); | 5528 parser_->RewriteDestructuringAssignments(); |
5533 } | 5529 } |
5534 | 5530 |
5535 | 5531 |
5536 Expression* ParserTraits::RewriteNonPattern( | 5532 void ParserTraits::RewriteNonPattern(Type::ExpressionClassifier* classifier, |
5537 Expression* expr, const ExpressionClassifier* classifier, bool* ok) { | 5533 bool* ok) { |
5538 return parser_->RewriteNonPattern(expr, classifier, ok); | 5534 parser_->RewriteNonPattern(classifier, ok); |
5539 } | 5535 } |
5540 | 5536 |
5541 | 5537 |
5542 ObjectLiteralProperty* ParserTraits::RewriteNonPatternObjectLiteralProperty( | 5538 Zone* ParserTraits::zone() const { |
5543 ObjectLiteralProperty* property, const ExpressionClassifier* classifier, | 5539 return parser_->function_state_->scope()->zone(); |
5544 bool* ok) { | |
5545 return parser_->RewriteNonPatternObjectLiteralProperty(property, classifier, | |
5546 ok); | |
5547 } | 5540 } |
5548 | 5541 |
5549 | 5542 |
| 5543 ZoneList<Expression*>* ParserTraits::GetNonPatternList() const { |
| 5544 return parser_->function_state_->non_patterns_to_rewrite(); |
| 5545 } |
| 5546 |
| 5547 |
5550 class NonPatternRewriter : public AstExpressionRewriter { | 5548 class NonPatternRewriter : public AstExpressionRewriter { |
5551 public: | 5549 public: |
5552 NonPatternRewriter(uintptr_t stack_limit, Parser* parser) | 5550 NonPatternRewriter(uintptr_t stack_limit, Parser* parser) |
5553 : AstExpressionRewriter(stack_limit), parser_(parser) {} | 5551 : AstExpressionRewriter(stack_limit), parser_(parser) {} |
5554 ~NonPatternRewriter() override {} | 5552 ~NonPatternRewriter() override {} |
5555 | 5553 |
5556 private: | 5554 private: |
5557 bool RewriteExpression(Expression* expr) override { | 5555 bool RewriteExpression(Expression* expr) override { |
| 5556 if (expr->IsRewritableExpression()) return true; |
5558 // Rewrite only what could have been a pattern but is not. | 5557 // Rewrite only what could have been a pattern but is not. |
5559 if (expr->IsArrayLiteral()) { | 5558 if (expr->IsArrayLiteral()) { |
5560 // Spread rewriting in array literals. | 5559 // Spread rewriting in array literals. |
5561 ArrayLiteral* lit = expr->AsArrayLiteral(); | 5560 ArrayLiteral* lit = expr->AsArrayLiteral(); |
5562 VisitExpressions(lit->values()); | 5561 VisitExpressions(lit->values()); |
5563 replacement_ = parser_->RewriteSpreads(lit); | 5562 replacement_ = parser_->RewriteSpreads(lit); |
5564 return false; | 5563 return false; |
5565 } | 5564 } |
5566 if (expr->IsObjectLiteral()) { | 5565 if (expr->IsObjectLiteral()) { |
5567 return true; | 5566 return true; |
5568 } | 5567 } |
5569 if (expr->IsBinaryOperation() && | 5568 if (expr->IsBinaryOperation() && |
5570 expr->AsBinaryOperation()->op() == Token::COMMA) { | 5569 expr->AsBinaryOperation()->op() == Token::COMMA) { |
5571 return true; | 5570 return true; |
5572 } | 5571 } |
5573 // Everything else does not need rewriting. | 5572 // Everything else does not need rewriting. |
5574 return false; | 5573 return false; |
5575 } | 5574 } |
5576 | 5575 |
5577 void VisitObjectLiteralProperty(ObjectLiteralProperty* property) override { | 5576 void VisitObjectLiteralProperty(ObjectLiteralProperty* property) override { |
5578 if (property == nullptr) return; | 5577 if (property == nullptr) return; |
5579 // Do not rewrite (computed) key expressions | 5578 // Do not rewrite (computed) key expressions |
5580 AST_REWRITE_PROPERTY(Expression, property, value); | 5579 AST_REWRITE_PROPERTY(Expression, property, value); |
5581 } | 5580 } |
5582 | 5581 |
5583 Parser* parser_; | 5582 Parser* parser_; |
5584 }; | 5583 }; |
5585 | 5584 |
5586 | 5585 |
5587 Expression* Parser::RewriteNonPattern(Expression* expr, | 5586 void Parser::RewriteNonPattern(ExpressionClassifier* classifier, bool* ok) { |
5588 const ExpressionClassifier* classifier, | |
5589 bool* ok) { | |
5590 ValidateExpression(classifier, ok); | 5587 ValidateExpression(classifier, ok); |
5591 if (!*ok) return expr; | 5588 if (!*ok) return; |
5592 NonPatternRewriter rewriter(stack_limit_, this); | 5589 auto non_patterns_to_rewrite = function_state_->non_patterns_to_rewrite(); |
5593 Expression* result = reinterpret_cast<Expression*>(rewriter.Rewrite(expr)); | 5590 int begin = classifier->GetNonPatternBegin(); |
5594 DCHECK_NOT_NULL(result); | 5591 int end = non_patterns_to_rewrite->length(); |
5595 return result; | 5592 if (begin < end) { |
5596 } | 5593 NonPatternRewriter rewriter(stack_limit_, this); |
5597 | 5594 for (int i = begin; i < end; i++) { |
5598 | 5595 DCHECK(non_patterns_to_rewrite->at(i)->IsRewritableExpression()); |
5599 ObjectLiteralProperty* Parser::RewriteNonPatternObjectLiteralProperty( | 5596 rewriter.Rewrite(non_patterns_to_rewrite->at(i)); |
5600 ObjectLiteralProperty* property, const ExpressionClassifier* classifier, | 5597 } |
5601 bool* ok) { | 5598 non_patterns_to_rewrite->Rewind(begin); |
5602 if (property != nullptr) { | |
5603 // Do not rewrite (computed) key expressions | |
5604 Expression* value = RewriteNonPattern(property->value(), classifier, ok); | |
5605 property->set_value(value); | |
5606 } | 5599 } |
5607 return property; | |
5608 } | 5600 } |
5609 | 5601 |
5610 | 5602 |
5611 void Parser::RewriteDestructuringAssignments() { | 5603 void Parser::RewriteDestructuringAssignments() { |
5612 FunctionState* func = function_state_; | |
5613 if (!allow_harmony_destructuring_assignment()) return; | 5604 if (!allow_harmony_destructuring_assignment()) return; |
5614 const List<DestructuringAssignment>& assignments = | 5605 const auto& assignments = |
5615 func->destructuring_assignments_to_rewrite(); | 5606 function_state_->destructuring_assignments_to_rewrite(); |
5616 for (int i = assignments.length() - 1; i >= 0; --i) { | 5607 for (int i = assignments.length() - 1; i >= 0; --i) { |
5617 // Rewrite list in reverse, so that nested assignment patterns are rewritten | 5608 // Rewrite list in reverse, so that nested assignment patterns are rewritten |
5618 // correctly. | 5609 // correctly. |
5619 DestructuringAssignment pair = assignments.at(i); | 5610 const DestructuringAssignment& pair = assignments.at(i); |
5620 RewritableAssignmentExpression* to_rewrite = | 5611 RewritableExpression* to_rewrite = |
5621 pair.assignment->AsRewritableAssignmentExpression(); | 5612 pair.assignment->AsRewritableExpression(); |
5622 Scope* scope = pair.scope; | |
5623 DCHECK_NOT_NULL(to_rewrite); | 5613 DCHECK_NOT_NULL(to_rewrite); |
5624 if (!to_rewrite->is_rewritten()) { | 5614 if (!to_rewrite->is_rewritten()) { |
5625 PatternRewriter::RewriteDestructuringAssignment(this, to_rewrite, scope); | 5615 PatternRewriter::RewriteDestructuringAssignment(this, to_rewrite, |
| 5616 pair.scope); |
5626 } | 5617 } |
5627 } | 5618 } |
5628 } | 5619 } |
5629 | 5620 |
5630 | 5621 |
5631 Expression* Parser::RewriteSpreads(ArrayLiteral* lit) { | 5622 Expression* Parser::RewriteSpreads(ArrayLiteral* lit) { |
5632 // Array literals containing spreads are rewritten using do expressions, e.g. | 5623 // Array literals containing spreads are rewritten using do expressions, e.g. |
5633 // [1, 2, 3, ...x, 4, ...y, 5] | 5624 // [1, 2, 3, ...x, 4, ...y, 5] |
5634 // is roughly rewritten as: | 5625 // is roughly rewritten as: |
5635 // do { | 5626 // do { |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5741 } | 5732 } |
5742 } | 5733 } |
5743 // Now, rewind the original array literal to truncate everything from the | 5734 // Now, rewind the original array literal to truncate everything from the |
5744 // first spread (included) until the end. This fixes $R's initialization. | 5735 // first spread (included) until the end. This fixes $R's initialization. |
5745 lit->RewindSpreads(); | 5736 lit->RewindSpreads(); |
5746 return factory()->NewDoExpression(do_block, result, lit->position()); | 5737 return factory()->NewDoExpression(do_block, result, lit->position()); |
5747 } | 5738 } |
5748 | 5739 |
5749 | 5740 |
5750 void ParserTraits::QueueDestructuringAssignmentForRewriting(Expression* expr) { | 5741 void ParserTraits::QueueDestructuringAssignmentForRewriting(Expression* expr) { |
5751 DCHECK(expr->IsRewritableAssignmentExpression()); | 5742 DCHECK(expr->IsRewritableExpression()); |
5752 parser_->function_state_->AddDestructuringAssignment( | 5743 parser_->function_state_->AddDestructuringAssignment( |
5753 Parser::DestructuringAssignment(expr, parser_->scope_)); | 5744 Parser::DestructuringAssignment(expr, parser_->scope_)); |
5754 } | 5745 } |
5755 | 5746 |
5756 | 5747 |
| 5748 void ParserTraits::QueueNonPatternForRewriting(Expression* expr) { |
| 5749 DCHECK(expr->IsRewritableExpression()); |
| 5750 parser_->function_state_->AddNonPatternForRewriting(expr); |
| 5751 } |
| 5752 |
| 5753 |
5757 void ParserTraits::SetFunctionNameFromPropertyName( | 5754 void ParserTraits::SetFunctionNameFromPropertyName( |
5758 ObjectLiteralProperty* property, const AstRawString* name) { | 5755 ObjectLiteralProperty* property, const AstRawString* name) { |
5759 Expression* value = property->value(); | 5756 Expression* value = property->value(); |
5760 | 5757 |
5761 // Computed name setting must happen at runtime. | 5758 // Computed name setting must happen at runtime. |
5762 if (property->is_computed_name()) return; | 5759 if (property->is_computed_name()) return; |
5763 | 5760 |
5764 // Getter and setter names are handled here because their names | 5761 // Getter and setter names are handled here because their names |
5765 // change in ES2015, even though they are not anonymous. | 5762 // change in ES2015, even though they are not anonymous. |
5766 auto function = value->AsFunctionLiteral(); | 5763 auto function = value->AsFunctionLiteral(); |
(...skipping 967 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6734 new_body->statements()->Add(loop->body(), zone); | 6731 new_body->statements()->Add(loop->body(), zone); |
6735 new_body->statements()->Add(set_completion_normal, zone); | 6732 new_body->statements()->Add(set_completion_normal, zone); |
6736 | 6733 |
6737 loop->set_body(new_body); | 6734 loop->set_body(new_body); |
6738 return final_loop; | 6735 return final_loop; |
6739 } | 6736 } |
6740 | 6737 |
6741 | 6738 |
6742 } // namespace internal | 6739 } // namespace internal |
6743 } // namespace v8 | 6740 } // namespace v8 |
OLD | NEW |