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

Side by Side Diff: src/prettyprinter.cc

Issue 3150032: Introduce a new intermediate AST node for encapsulating the... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 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 | Annotate | Revision Log
« no previous file with comments | « src/parser.cc ('k') | src/rewriter.cc » ('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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 } 369 }
370 370
371 371
372 void PrettyPrinter::VisitUnaryOperation(UnaryOperation* node) { 372 void PrettyPrinter::VisitUnaryOperation(UnaryOperation* node) {
373 Print("(%s", Token::String(node->op())); 373 Print("(%s", Token::String(node->op()));
374 Visit(node->expression()); 374 Visit(node->expression());
375 Print(")"); 375 Print(")");
376 } 376 }
377 377
378 378
379 void PrettyPrinter::VisitIncrementOperation(IncrementOperation* node) {
380 UNREACHABLE();
381 }
382
383
379 void PrettyPrinter::VisitCountOperation(CountOperation* node) { 384 void PrettyPrinter::VisitCountOperation(CountOperation* node) {
380 Print("("); 385 Print("(");
381 if (node->is_prefix()) Print("%s", Token::String(node->op())); 386 if (node->is_prefix()) Print("%s", Token::String(node->op()));
382 Visit(node->expression()); 387 Visit(node->expression());
383 if (node->is_postfix()) Print("%s", Token::String(node->op())); 388 if (node->is_postfix()) Print("%s", Token::String(node->op()));
384 Print(")"); 389 Print(")");
385 } 390 }
386 391
387 392
388 void PrettyPrinter::VisitBinaryOperation(BinaryOperation* node) { 393 void PrettyPrinter::VisitBinaryOperation(BinaryOperation* node) {
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after
1070 IndentedScope indent; 1075 IndentedScope indent;
1071 PrintArguments(node->arguments()); 1076 PrintArguments(node->arguments());
1072 } 1077 }
1073 1078
1074 1079
1075 void AstPrinter::VisitUnaryOperation(UnaryOperation* node) { 1080 void AstPrinter::VisitUnaryOperation(UnaryOperation* node) {
1076 PrintIndentedVisit(Token::Name(node->op()), node->expression()); 1081 PrintIndentedVisit(Token::Name(node->op()), node->expression());
1077 } 1082 }
1078 1083
1079 1084
1085 void AstPrinter::VisitIncrementOperation(IncrementOperation* node) {
1086 UNREACHABLE();
1087 }
1088
1089
1080 void AstPrinter::VisitCountOperation(CountOperation* node) { 1090 void AstPrinter::VisitCountOperation(CountOperation* node) {
1081 EmbeddedVector<char, 128> buf; 1091 EmbeddedVector<char, 128> buf;
1082 if (node->type()->IsKnown()) { 1092 if (node->type()->IsKnown()) {
1083 OS::SNPrintF(buf, "%s %s (type = %s)", 1093 OS::SNPrintF(buf, "%s %s (type = %s)",
1084 (node->is_prefix() ? "PRE" : "POST"), 1094 (node->is_prefix() ? "PRE" : "POST"),
1085 Token::Name(node->op()), 1095 Token::Name(node->op()),
1086 StaticType::Type2String(node->type())); 1096 StaticType::Type2String(node->type()));
1087 } else { 1097 } else {
1088 OS::SNPrintF(buf, "%s %s", (node->is_prefix() ? "PRE" : "POST"), 1098 OS::SNPrintF(buf, "%s %s", (node->is_prefix() ? "PRE" : "POST"),
1089 Token::Name(node->op())); 1099 Token::Name(node->op()));
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
1470 void JsonAstBuilder::VisitUnaryOperation(UnaryOperation* expr) { 1480 void JsonAstBuilder::VisitUnaryOperation(UnaryOperation* expr) {
1471 TagScope tag(this, "UnaryOperation"); 1481 TagScope tag(this, "UnaryOperation");
1472 { 1482 {
1473 AttributesScope attributes(this); 1483 AttributesScope attributes(this);
1474 AddAttribute("op", Token::Name(expr->op())); 1484 AddAttribute("op", Token::Name(expr->op()));
1475 } 1485 }
1476 Visit(expr->expression()); 1486 Visit(expr->expression());
1477 } 1487 }
1478 1488
1479 1489
1490 void JsonAstBuilder::VisitIncrementOperation(IncrementOperation* expr) {
1491 UNREACHABLE();
1492 }
1493
1494
1480 void JsonAstBuilder::VisitCountOperation(CountOperation* expr) { 1495 void JsonAstBuilder::VisitCountOperation(CountOperation* expr) {
1481 TagScope tag(this, "CountOperation"); 1496 TagScope tag(this, "CountOperation");
1482 { 1497 {
1483 AttributesScope attributes(this); 1498 AttributesScope attributes(this);
1484 AddAttribute("is_prefix", expr->is_prefix()); 1499 AddAttribute("is_prefix", expr->is_prefix());
1485 AddAttribute("op", Token::Name(expr->op())); 1500 AddAttribute("op", Token::Name(expr->op()));
1486 } 1501 }
1487 Visit(expr->expression()); 1502 Visit(expr->expression());
1488 } 1503 }
1489 1504
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
1532 AddAttribute("mode", Variable::Mode2String(decl->mode())); 1547 AddAttribute("mode", Variable::Mode2String(decl->mode()));
1533 } 1548 }
1534 Visit(decl->proxy()); 1549 Visit(decl->proxy());
1535 if (decl->fun() != NULL) Visit(decl->fun()); 1550 if (decl->fun() != NULL) Visit(decl->fun());
1536 } 1551 }
1537 1552
1538 1553
1539 #endif // DEBUG 1554 #endif // DEBUG
1540 1555
1541 } } // namespace v8::internal 1556 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/parser.cc ('k') | src/rewriter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698