| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/ast/ast.h" | 5 #include "src/ast/ast.h" |
| 6 #include "src/messages.h" | 6 #include "src/messages.h" |
| 7 #include "src/parsing/parameter-initializer-rewriter.h" | 7 #include "src/parsing/parameter-initializer-rewriter.h" |
| 8 #include "src/parsing/parser.h" | 8 #include "src/parsing/parser.h" |
| 9 | 9 |
| 10 namespace v8 { | 10 namespace v8 { |
| (...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 // parsing. | 386 // parsing. |
| 387 void Parser::PatternRewriter::RewriteParameterScopes(Expression* expr) { | 387 void Parser::PatternRewriter::RewriteParameterScopes(Expression* expr) { |
| 388 if (!IsBindingContext()) return; | 388 if (!IsBindingContext()) return; |
| 389 if (descriptor_->declaration_kind != DeclarationDescriptor::PARAMETER) return; | 389 if (descriptor_->declaration_kind != DeclarationDescriptor::PARAMETER) return; |
| 390 if (!scope()->is_block_scope()) return; | 390 if (!scope()->is_block_scope()) return; |
| 391 | 391 |
| 392 DCHECK(scope()->is_declaration_scope()); | 392 DCHECK(scope()->is_declaration_scope()); |
| 393 DCHECK(scope()->outer_scope()->is_function_scope()); | 393 DCHECK(scope()->outer_scope()->is_function_scope()); |
| 394 DCHECK(scope()->calls_sloppy_eval()); | 394 DCHECK(scope()->calls_sloppy_eval()); |
| 395 | 395 |
| 396 ReparentParameterExpressionScope(parser_->stack_limit(), expr, scope()); | 396 ReparentParameterExpressionScope(parser_->stack_limit(), expr, |
| 397 scope()->outer_scope(), scope()); |
| 397 } | 398 } |
| 398 | 399 |
| 399 void Parser::PatternRewriter::VisitObjectLiteral(ObjectLiteral* pattern, | 400 void Parser::PatternRewriter::VisitObjectLiteral(ObjectLiteral* pattern, |
| 400 Variable** temp_var) { | 401 Variable** temp_var) { |
| 401 auto temp = *temp_var = CreateTempVar(current_value_); | 402 auto temp = *temp_var = CreateTempVar(current_value_); |
| 402 | 403 |
| 403 block_->statements()->Add(parser_->BuildAssertIsCoercible(temp), zone()); | 404 block_->statements()->Add(parser_->BuildAssertIsCoercible(temp), zone()); |
| 404 | 405 |
| 405 for (ObjectLiteralProperty* property : *pattern->properties()) { | 406 for (ObjectLiteralProperty* property : *pattern->properties()) { |
| 406 PatternContext context = SetInitializerContextIfNeeded(property->value()); | 407 PatternContext context = SetInitializerContextIfNeeded(property->value()); |
| (...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 758 NOT_A_PATTERN(TryFinallyStatement) | 759 NOT_A_PATTERN(TryFinallyStatement) |
| 759 NOT_A_PATTERN(UnaryOperation) | 760 NOT_A_PATTERN(UnaryOperation) |
| 760 NOT_A_PATTERN(VariableDeclaration) | 761 NOT_A_PATTERN(VariableDeclaration) |
| 761 NOT_A_PATTERN(WhileStatement) | 762 NOT_A_PATTERN(WhileStatement) |
| 762 NOT_A_PATTERN(WithStatement) | 763 NOT_A_PATTERN(WithStatement) |
| 763 NOT_A_PATTERN(Yield) | 764 NOT_A_PATTERN(Yield) |
| 764 | 765 |
| 765 #undef NOT_A_PATTERN | 766 #undef NOT_A_PATTERN |
| 766 } // namespace internal | 767 } // namespace internal |
| 767 } // namespace v8 | 768 } // namespace v8 |
| OLD | NEW |