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

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

Issue 2302643002: Split the AST representation of class properties from object properties (Closed)
Patch Set: rebase Created 4 years, 3 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 29 matching lines...) Expand all
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 if (class_literal->extends() != nullptr) { 45 if (class_literal->extends() != nullptr) {
46 Visit(class_literal->extends()); 46 Visit(class_literal->extends());
47 } 47 }
48 // 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
49 // scope on its scope chain. 49 // scope on its scope chain.
50 ZoneList<ObjectLiteralProperty*>* props = class_literal->properties(); 50 ZoneList<ClassLiteralProperty*>* props = class_literal->properties();
51 for (int i = 0; i < props->length(); ++i) { 51 for (int i = 0; i < props->length(); ++i) {
52 ObjectLiteralProperty* prop = props->at(i); 52 ClassLiteralProperty* prop = props->at(i);
53 if (!prop->key()->IsLiteral()) { 53 if (!prop->key()->IsLiteral()) {
54 Visit(prop->key()); 54 Visit(prop->key());
55 } 55 }
56 // No need to visit the values, since all values are functions with 56 // No need to visit the values, since all values are functions with
57 // the class scope on their scope chain. 57 // the class scope on their scope chain.
58 DCHECK(prop->value()->IsFunctionLiteral()); 58 DCHECK(prop->value()->IsFunctionLiteral());
59 } 59 }
60 } 60 }
61 61
62 62
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 DCHECK(param_scope->calls_sloppy_eval()); 104 DCHECK(param_scope->calls_sloppy_eval());
105 DCHECK(param_scope->outer_scope()->is_function_scope()); 105 DCHECK(param_scope->outer_scope()->is_function_scope());
106 106
107 Rewriter rewriter(stack_limit, expr, param_scope); 107 Rewriter rewriter(stack_limit, expr, param_scope);
108 rewriter.Run(); 108 rewriter.Run();
109 } 109 }
110 110
111 111
112 } // namespace internal 112 } // namespace internal
113 } // 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