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

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

Issue 2849773002: Revert of Wrap ClassLiterals in DoExpressions instead of giving them BlockScopes. Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 3 years, 7 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_);
45 if (class_literal->extends() != nullptr) { 46 if (class_literal->extends() != nullptr) {
46 Visit(class_literal->extends()); 47 Visit(class_literal->extends());
47 } 48 }
48 // No need to visit the constructor since it will have the class 49 // No need to visit the constructor since it will have the class
49 // scope on its scope chain. 50 // scope on its scope chain.
50 ZoneList<ObjectLiteralProperty*>* props = class_literal->properties(); 51 ZoneList<ObjectLiteralProperty*>* props = class_literal->properties();
51 for (int i = 0; i < props->length(); ++i) { 52 for (int i = 0; i < props->length(); ++i) {
52 ObjectLiteralProperty* prop = props->at(i); 53 ObjectLiteralProperty* prop = props->at(i);
53 if (!prop->key()->IsLiteral()) { 54 if (!prop->key()->IsLiteral()) {
54 Visit(prop->key()); 55 Visit(prop->key());
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 DCHECK(param_scope->calls_sloppy_eval()); 105 DCHECK(param_scope->calls_sloppy_eval());
105 DCHECK(param_scope->outer_scope()->is_function_scope()); 106 DCHECK(param_scope->outer_scope()->is_function_scope());
106 107
107 Rewriter rewriter(stack_limit, expr, param_scope); 108 Rewriter rewriter(stack_limit, expr, param_scope);
108 rewriter.Run(); 109 rewriter.Run();
109 } 110 }
110 111
111 112
112 } // namespace internal 113 } // namespace internal
113 } // namespace v8 114 } // 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