Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(113)

Side by Side Diff: src/parsing/parser.cc

Issue 1864553002: [destructuring] don't attempt to visit contents of FunctionLiterals (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Use adam's preferred approach Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | test/mjsunit/es6/regress/regress-594084.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 void VisitFunctionLiteral(FunctionLiteral* expr) override {}
adamk 2016/04/05 18:14:54 Please add a comment explaining why this is OK.
4406
4405 private: 4407 private:
4406 Parser* parser_; 4408 Parser* parser_;
4407 Scope* scope_; 4409 Scope* scope_;
4408 }; 4410 };
4409 4411
4410 4412
4411 void Parser::RewriteParameterInitializer(Expression* expr, Scope* scope) { 4413 void Parser::RewriteParameterInitializer(Expression* expr, Scope* scope) {
4412 InitializerRewriter rewriter(stack_limit_, expr, this, scope); 4414 InitializerRewriter rewriter(stack_limit_, expr, this, scope);
4413 rewriter.Run(); 4415 rewriter.Run();
4414 } 4416 }
(...skipping 2450 matching lines...) Expand 10 before | Expand all | Expand 10 after
6865 try_block, target); 6867 try_block, target);
6866 final_loop = target; 6868 final_loop = target;
6867 } 6869 }
6868 6870
6869 return final_loop; 6871 return final_loop;
6870 } 6872 }
6871 6873
6872 6874
6873 } // namespace internal 6875 } // namespace internal
6874 } // namespace v8 6876 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/es6/regress/regress-594084.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698