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

Side by Side Diff: src/parsing/parameter-initializer-rewriter.cc

Issue 2176653003: Wrap ClassLiterals in DoExpressions instead of giving them BlockScopes. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: address comments Created 4 years, 5 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 | « src/interpreter/bytecode-generator.cc ('k') | src/parsing/parser.h » ('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 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/parsing/parameter-initializer-rewriter.h" 5 #include "src/parsing/parameter-initializer-rewriter.h"
6 6
7 #include "src/ast/ast.h" 7 #include "src/ast/ast.h"
8 #include "src/ast/ast-traversal-visitor.h" 8 #include "src/ast/ast-traversal-visitor.h"
9 #include "src/ast/scopes.h" 9 #include "src/ast/scopes.h"
10 10
(...skipping 24 matching lines...) Expand all
35 35
36 Scope* param_scope_; 36 Scope* param_scope_;
37 }; 37 };
38 38
39 void Rewriter::VisitFunctionLiteral(FunctionLiteral* function_literal) { 39 void Rewriter::VisitFunctionLiteral(FunctionLiteral* function_literal) {
40 function_literal->scope()->ReplaceOuterScope(param_scope_); 40 function_literal->scope()->ReplaceOuterScope(param_scope_);
41 } 41 }
42 42
43 43
44 void Rewriter::VisitClassLiteral(ClassLiteral* class_literal) { 44 void Rewriter::VisitClassLiteral(ClassLiteral* class_literal) {
45 class_literal->scope()->ReplaceOuterScope(param_scope_);
46 if (class_literal->extends() != nullptr) { 45 if (class_literal->extends() != nullptr) {
47 Visit(class_literal->extends()); 46 Visit(class_literal->extends());
48 } 47 }
49 // No need to visit the constructor since it will have the class 48 // No need to visit the constructor since it will have the class
50 // scope on its scope chain. 49 // scope on its scope chain.
51 ZoneList<ObjectLiteralProperty*>* props = class_literal->properties(); 50 ZoneList<ObjectLiteralProperty*>* props = class_literal->properties();
52 for (int i = 0; i < props->length(); ++i) { 51 for (int i = 0; i < props->length(); ++i) {
53 ObjectLiteralProperty* prop = props->at(i); 52 ObjectLiteralProperty* prop = props->at(i);
54 if (!prop->key()->IsLiteral()) { 53 if (!prop->key()->IsLiteral()) {
55 Visit(prop->key()); 54 Visit(prop->key());
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 DCHECK(param_scope->calls_sloppy_eval()); 104 DCHECK(param_scope->calls_sloppy_eval());
106 DCHECK(param_scope->outer_scope()->is_function_scope()); 105 DCHECK(param_scope->outer_scope()->is_function_scope());
107 106
108 Rewriter rewriter(stack_limit, expr, param_scope); 107 Rewriter rewriter(stack_limit, expr, param_scope);
109 rewriter.Run(); 108 rewriter.Run();
110 } 109 }
111 110
112 111
113 } // namespace internal 112 } // namespace internal
114 } // namespace v8 113 } // namespace v8
OLDNEW
« no previous file with comments | « src/interpreter/bytecode-generator.cc ('k') | src/parsing/parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698