| 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 4376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4387 | 4387 |
| 4388 class InitializerRewriter : public AstExpressionVisitor { | 4388 class InitializerRewriter : public AstExpressionVisitor { |
| 4389 public: | 4389 public: |
| 4390 InitializerRewriter(uintptr_t stack_limit, Expression* root, Parser* parser, | 4390 InitializerRewriter(uintptr_t stack_limit, Expression* root, Parser* parser, |
| 4391 Scope* scope) | 4391 Scope* scope) |
| 4392 : AstExpressionVisitor(stack_limit, root), | 4392 : AstExpressionVisitor(stack_limit, root), |
| 4393 parser_(parser), | 4393 parser_(parser), |
| 4394 scope_(scope) {} | 4394 scope_(scope) {} |
| 4395 | 4395 |
| 4396 private: | 4396 private: |
| 4397 void VisitExpression(Expression* expr) { | 4397 void VisitExpression(Expression* expr) override { |
| 4398 RewritableExpression* to_rewrite = expr->AsRewritableExpression(); | 4398 RewritableExpression* to_rewrite = expr->AsRewritableExpression(); |
| 4399 if (to_rewrite == nullptr || to_rewrite->is_rewritten()) return; | 4399 if (to_rewrite == nullptr || to_rewrite->is_rewritten()) return; |
| 4400 | 4400 |
| 4401 Parser::PatternRewriter::RewriteDestructuringAssignment(parser_, to_rewrite, | 4401 Parser::PatternRewriter::RewriteDestructuringAssignment(parser_, to_rewrite, |
| 4402 scope_); | 4402 scope_); |
| 4403 } | 4403 } |
| 4404 | 4404 |
| 4405 // Code in function literals does not need to be eagerly rewritten, it will be |
| 4406 // rewritten when scheduled. |
| 4407 void VisitFunctionLiteral(FunctionLiteral* expr) override {} |
| 4408 |
| 4405 private: | 4409 private: |
| 4406 Parser* parser_; | 4410 Parser* parser_; |
| 4407 Scope* scope_; | 4411 Scope* scope_; |
| 4408 }; | 4412 }; |
| 4409 | 4413 |
| 4410 | 4414 |
| 4411 void Parser::RewriteParameterInitializer(Expression* expr, Scope* scope) { | 4415 void Parser::RewriteParameterInitializer(Expression* expr, Scope* scope) { |
| 4412 InitializerRewriter rewriter(stack_limit_, expr, this, scope); | 4416 InitializerRewriter rewriter(stack_limit_, expr, this, scope); |
| 4413 rewriter.Run(); | 4417 rewriter.Run(); |
| 4414 } | 4418 } |
| (...skipping 2450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6865 try_block, target); | 6869 try_block, target); |
| 6866 final_loop = target; | 6870 final_loop = target; |
| 6867 } | 6871 } |
| 6868 | 6872 |
| 6869 return final_loop; | 6873 return final_loop; |
| 6870 } | 6874 } |
| 6871 | 6875 |
| 6872 | 6876 |
| 6873 } // namespace internal | 6877 } // namespace internal |
| 6874 } // namespace v8 | 6878 } // namespace v8 |
| OLD | NEW |