OLD | NEW |
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 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 | 363 |
364 | 364 |
365 void PrettyPrinter::VisitCallRuntime(CallRuntime* node) { | 365 void PrettyPrinter::VisitCallRuntime(CallRuntime* node) { |
366 Print("%%"); | 366 Print("%%"); |
367 PrintLiteral(node->name(), false); | 367 PrintLiteral(node->name(), false); |
368 PrintArguments(node->arguments()); | 368 PrintArguments(node->arguments()); |
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 Token::Value op = node->op(); |
| 374 bool needsSpace = |
| 375 op == Token::DELETE || op == Token::TYPEOF || op == Token::VOID; |
| 376 Print("(%s%s", Token::String(op), needsSpace ? " " : ""); |
374 Visit(node->expression()); | 377 Visit(node->expression()); |
375 Print(")"); | 378 Print(")"); |
376 } | 379 } |
377 | 380 |
378 | 381 |
379 void PrettyPrinter::VisitCountOperation(CountOperation* node) { | 382 void PrettyPrinter::VisitCountOperation(CountOperation* node) { |
380 Print("("); | 383 Print("("); |
381 if (node->is_prefix()) Print("%s", Token::String(node->op())); | 384 if (node->is_prefix()) Print("%s", Token::String(node->op())); |
382 Visit(node->expression()); | 385 Visit(node->expression()); |
383 if (node->is_postfix()) Print("%s", Token::String(node->op())); | 386 if (node->is_postfix()) Print("%s", Token::String(node->op())); |
384 Print(")"); | 387 Print(")"); |
385 } | 388 } |
386 | 389 |
387 | 390 |
388 void PrettyPrinter::VisitBinaryOperation(BinaryOperation* node) { | 391 void PrettyPrinter::VisitBinaryOperation(BinaryOperation* node) { |
389 Print("("); | 392 Print("("); |
390 Visit(node->left()); | 393 Visit(node->left()); |
391 Print("%s", Token::String(node->op())); | 394 Print(" %s ", Token::String(node->op())); |
392 Visit(node->right()); | 395 Visit(node->right()); |
393 Print(")"); | 396 Print(")"); |
394 } | 397 } |
395 | 398 |
396 | 399 |
397 void PrettyPrinter::VisitCompareOperation(CompareOperation* node) { | 400 void PrettyPrinter::VisitCompareOperation(CompareOperation* node) { |
398 Print("("); | 401 Print("("); |
399 Visit(node->left()); | 402 Visit(node->left()); |
400 Print("%s", Token::String(node->op())); | 403 Print(" %s ", Token::String(node->op())); |
401 Visit(node->right()); | 404 Visit(node->right()); |
402 Print(")"); | 405 Print(")"); |
403 } | 406 } |
404 | 407 |
405 | 408 |
406 void PrettyPrinter::VisitCompareToNull(CompareToNull* node) { | 409 void PrettyPrinter::VisitCompareToNull(CompareToNull* node) { |
407 Print("("); | 410 Print("("); |
408 Visit(node->expression()); | 411 Visit(node->expression()); |
409 Print("%s null)", Token::String(node->op())); | 412 Print("%s null)", Token::String(node->op())); |
410 } | 413 } |
(...skipping 1070 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1481 AddAttribute("mode", Variable::Mode2String(decl->mode())); | 1484 AddAttribute("mode", Variable::Mode2String(decl->mode())); |
1482 } | 1485 } |
1483 Visit(decl->proxy()); | 1486 Visit(decl->proxy()); |
1484 if (decl->fun() != NULL) Visit(decl->fun()); | 1487 if (decl->fun() != NULL) Visit(decl->fun()); |
1485 } | 1488 } |
1486 | 1489 |
1487 | 1490 |
1488 #endif // DEBUG | 1491 #endif // DEBUG |
1489 | 1492 |
1490 } } // namespace v8::internal | 1493 } } // namespace v8::internal |
OLD | NEW |