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 4367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4378 RelocInfo::kNoPosition); | 4378 RelocInfo::kNoPosition); |
4379 IfStatement* if_statement = factory()->NewIfStatement( | 4379 IfStatement* if_statement = factory()->NewIfStatement( |
4380 condition, factory()->NewExpressionStatement(throw_type_error, | 4380 condition, factory()->NewExpressionStatement(throw_type_error, |
4381 RelocInfo::kNoPosition), | 4381 RelocInfo::kNoPosition), |
4382 factory()->NewEmptyStatement(RelocInfo::kNoPosition), | 4382 factory()->NewEmptyStatement(RelocInfo::kNoPosition), |
4383 RelocInfo::kNoPosition); | 4383 RelocInfo::kNoPosition); |
4384 return if_statement; | 4384 return if_statement; |
4385 } | 4385 } |
4386 | 4386 |
4387 | 4387 |
4388 class InitializerRewriter : public AstExpressionVisitor { | 4388 class InitializerRewriter : public AstExpressionVisitor { |
adamk
2016/04/05 17:54:30
It seems like a more minimal fix for the problem a
caitp (gmail)
2016/04/05 18:02:05
involves a lot more actual changes to do it that w
adamk
2016/04/05 18:06:26
You shouldn't need to touch the base class at all:
caitp (gmail)
2016/04/05 18:13:23
Done.
| |
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, AstExpressionVisitor::Shallow), |
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) { |
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_); |
(...skipping 2462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6865 try_block, target); | 6865 try_block, target); |
6866 final_loop = target; | 6866 final_loop = target; |
6867 } | 6867 } |
6868 | 6868 |
6869 return final_loop; | 6869 return final_loop; |
6870 } | 6870 } |
6871 | 6871 |
6872 | 6872 |
6873 } // namespace internal | 6873 } // namespace internal |
6874 } // namespace v8 | 6874 } // namespace v8 |
OLD | NEW |