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

Side by Side Diff: src/ast/prettyprinter.cc

Issue 2142333002: Refactor class declaration logic to the parser and runtime Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: minor cleanup per Adam 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
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/ast/prettyprinter.h" 5 #include "src/ast/prettyprinter.h"
6 6
7 #include <stdarg.h> 7 #include <stdarg.h>
8 8
9 #include "src/ast/ast-value-factory.h" 9 #include "src/ast/ast-value-factory.h"
10 #include "src/ast/scopes.h" 10 #include "src/ast/scopes.h"
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 211
212 212
213 void CallPrinter::VisitDebuggerStatement(DebuggerStatement* node) {} 213 void CallPrinter::VisitDebuggerStatement(DebuggerStatement* node) {}
214 214
215 215
216 void CallPrinter::VisitFunctionLiteral(FunctionLiteral* node) { 216 void CallPrinter::VisitFunctionLiteral(FunctionLiteral* node) {
217 FindStatements(node->body()); 217 FindStatements(node->body());
218 } 218 }
219 219
220 220
221 void CallPrinter::VisitClassLiteral(ClassLiteral* node) {
222 if (node->extends()) Find(node->extends());
223 for (int i = 0; i < node->properties()->length(); i++) {
224 Find(node->properties()->at(i)->value());
225 }
226 }
227
228
229 void CallPrinter::VisitNativeFunctionLiteral(NativeFunctionLiteral* node) {} 221 void CallPrinter::VisitNativeFunctionLiteral(NativeFunctionLiteral* node) {}
230 222
231 223
232 void CallPrinter::VisitDoExpression(DoExpression* node) { Find(node->block()); } 224 void CallPrinter::VisitDoExpression(DoExpression* node) { Find(node->block()); }
233 225
234 226
235 void CallPrinter::VisitConditional(Conditional* node) { 227 void CallPrinter::VisitConditional(Conditional* node) {
236 Find(node->condition()); 228 Find(node->condition());
237 Find(node->then_expression()); 229 Find(node->then_expression());
238 Find(node->else_expression()); 230 Find(node->else_expression());
(...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after
910 PrintLiteralIndented("NAME", node->name(), false); 902 PrintLiteralIndented("NAME", node->name(), false);
911 PrintLiteralIndented("INFERRED NAME", node->inferred_name(), false); 903 PrintLiteralIndented("INFERRED NAME", node->inferred_name(), false);
912 PrintParameters(node->scope()); 904 PrintParameters(node->scope());
913 // We don't want to see the function literal in this case: it 905 // We don't want to see the function literal in this case: it
914 // will be printed via PrintProgram when the code for it is 906 // will be printed via PrintProgram when the code for it is
915 // generated. 907 // generated.
916 // PrintStatements(node->body()); 908 // PrintStatements(node->body());
917 } 909 }
918 910
919 911
920 void AstPrinter::VisitClassLiteral(ClassLiteral* node) {
921 IndentedScope indent(this, "CLASS LITERAL", node->position());
922 PrintLiteralIndented("NAME", node->constructor()->name(), false);
923 if (node->extends() != nullptr) {
924 PrintIndentedVisit("EXTENDS", node->extends());
925 }
926 PrintProperties(node->properties());
927 }
928
929
930 void AstPrinter::PrintProperties( 912 void AstPrinter::PrintProperties(
931 ZoneList<ObjectLiteral::Property*>* properties) { 913 ZoneList<ObjectLiteral::Property*>* properties) {
932 for (int i = 0; i < properties->length(); i++) { 914 for (int i = 0; i < properties->length(); i++) {
933 ObjectLiteral::Property* property = properties->at(i); 915 ObjectLiteral::Property* property = properties->at(i);
934 const char* prop_kind = nullptr; 916 const char* prop_kind = nullptr;
935 switch (property->kind()) { 917 switch (property->kind()) {
936 case ObjectLiteral::Property::CONSTANT: 918 case ObjectLiteral::Property::CONSTANT:
937 prop_kind = "CONSTANT"; 919 prop_kind = "CONSTANT";
938 break; 920 break;
939 case ObjectLiteral::Property::COMPUTED: 921 case ObjectLiteral::Property::COMPUTED:
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
1186 1168
1187 void AstPrinter::VisitRewritableExpression(RewritableExpression* node) { 1169 void AstPrinter::VisitRewritableExpression(RewritableExpression* node) {
1188 Visit(node->expression()); 1170 Visit(node->expression());
1189 } 1171 }
1190 1172
1191 1173
1192 #endif // DEBUG 1174 #endif // DEBUG
1193 1175
1194 } // namespace internal 1176 } // namespace internal
1195 } // namespace v8 1177 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698