| 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/objects-inl.h" | 7 #include "src/objects-inl.h" |
| 8 #include "src/parsing/parameter-initializer-rewriter.h" | 8 #include "src/parsing/parameter-initializer-rewriter.h" |
| 9 #include "src/parsing/parser.h" | 9 #include "src/parsing/parser.h" |
| 10 | 10 |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 } | 302 } |
| 303 DCHECK_NOT_NULL(temp); | 303 DCHECK_NOT_NULL(temp); |
| 304 current_value_ = old_value; | 304 current_value_ = old_value; |
| 305 Expression* expr = factory()->NewDoExpression(block_, temp, pos); | 305 Expression* expr = factory()->NewDoExpression(block_, temp, pos); |
| 306 node->Rewrite(expr); | 306 node->Rewrite(expr); |
| 307 block_ = old_block; | 307 block_ = old_block; |
| 308 if (block_) { | 308 if (block_) { |
| 309 block_->statements()->Add(factory()->NewExpressionStatement(expr, pos), | 309 block_->statements()->Add(factory()->NewExpressionStatement(expr, pos), |
| 310 zone()); | 310 zone()); |
| 311 } | 311 } |
| 312 return set_context(old_context); | 312 set_context(old_context); |
| 313 } | 313 } |
| 314 | 314 |
| 315 // When an extra declaration scope needs to be inserted to account for | 315 // When an extra declaration scope needs to be inserted to account for |
| 316 // a sloppy eval in a default parameter or function body, the expressions | 316 // a sloppy eval in a default parameter or function body, the expressions |
| 317 // needs to be in that new inner scope which was added after initial | 317 // needs to be in that new inner scope which was added after initial |
| 318 // parsing. | 318 // parsing. |
| 319 void Parser::PatternRewriter::RewriteParameterScopes(Expression* expr) { | 319 void Parser::PatternRewriter::RewriteParameterScopes(Expression* expr) { |
| 320 if (!IsBindingContext()) return; | 320 if (!IsBindingContext()) return; |
| 321 if (descriptor_->declaration_kind != DeclarationDescriptor::PARAMETER) return; | 321 if (descriptor_->declaration_kind != DeclarationDescriptor::PARAMETER) return; |
| 322 if (!scope()->is_block_scope()) return; | 322 if (!scope()->is_block_scope()) return; |
| (...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 692 NOT_A_PATTERN(TryFinallyStatement) | 692 NOT_A_PATTERN(TryFinallyStatement) |
| 693 NOT_A_PATTERN(UnaryOperation) | 693 NOT_A_PATTERN(UnaryOperation) |
| 694 NOT_A_PATTERN(VariableDeclaration) | 694 NOT_A_PATTERN(VariableDeclaration) |
| 695 NOT_A_PATTERN(WhileStatement) | 695 NOT_A_PATTERN(WhileStatement) |
| 696 NOT_A_PATTERN(WithStatement) | 696 NOT_A_PATTERN(WithStatement) |
| 697 NOT_A_PATTERN(Yield) | 697 NOT_A_PATTERN(Yield) |
| 698 | 698 |
| 699 #undef NOT_A_PATTERN | 699 #undef NOT_A_PATTERN |
| 700 } // namespace internal | 700 } // namespace internal |
| 701 } // namespace v8 | 701 } // namespace v8 |
| OLD | NEW |