724 }
725 }
726
727 public void visitSkip(JCSkip tree) {
728 try {
729 print(";");
730 } catch (IOException e) {
731 throw new UncheckedIOException(e);
732 }
733 }
734
735 public void visitBlock(JCBlock tree) {
736 try {
737 printFlags(tree.flags);
738 printBlock(tree.stats);
739 } catch (IOException e) {
740 throw new UncheckedIOException(e);
741 }
742 }
743
744 public void visitDoLoop(JCDoWhileLoop tree) {
745 try {
746 print("do ");
747 printStat(tree.body);
748 align();
749 print(" while ");
750 if (tree.cond.hasTag(PARENS)) {
751 printExpr(tree.cond);
752 } else {
753 print("(");
754 printExpr(tree.cond);
755 print(")");
756 }
757 print(";");
758 } catch (IOException e) {
759 throw new UncheckedIOException(e);
760 }
761 }
762
763 public void visitWhileLoop(JCWhileLoop tree) {
764 try {
765 print("while ");
766 if (tree.cond.hasTag(PARENS)) {
767 printExpr(tree.cond);
768 } else {
769 print("(");
770 printExpr(tree.cond);
771 print(")");
772 }
773 print(" ");
774 printStat(tree.body);
775 } catch (IOException e) {
776 throw new UncheckedIOException(e);
777 }
778 }
779
780 public void visitForLoop(JCForLoop tree) {
781 try {
782 print("for (");
783 if (tree.init.nonEmpty()) {
784 if (tree.init.head.hasTag(VARDEF)) {
785 printExpr(tree.init.head);
786 for (List<JCStatement> l = tree.init.tail; l.nonEmpty(); l = l.tail) {
787 JCVariableDecl vdef = (JCVariableDecl)l.head;
788 print(", " + vdef.name);
789 if (vdef.init != null) {
790 print(" = ");
791 printExpr(vdef.init);
792 }
793 }
794 } else {
795 printExprs(tree.init);
796 }
797 }
798 print("; ");
799 if (tree.cond != null) printExpr(tree.cond);
|
724 }
725 }
726
727 public void visitSkip(JCSkip tree) {
728 try {
729 print(";");
730 } catch (IOException e) {
731 throw new UncheckedIOException(e);
732 }
733 }
734
735 public void visitBlock(JCBlock tree) {
736 try {
737 printFlags(tree.flags);
738 printBlock(tree.stats);
739 } catch (IOException e) {
740 throw new UncheckedIOException(e);
741 }
742 }
743
744 public void visitDefaultValue(JCDefaultValue tree) {
745 try {
746 printExpr(tree.clazz, TreeInfo.postfixPrec);
747 print(".default");
748 } catch (IOException e) {
749 throw new UncheckedIOException(e);
750 }
751 }
752
753 public void visitDoLoop(JCDoWhileLoop tree) {
754 try {
755 print("do ");
756 printStat(tree.body);
757 align();
758 print(" while ");
759 if (tree.cond.hasTag(PARENS)) {
760 printExpr(tree.cond);
761 } else {
762 print("(");
763 printExpr(tree.cond);
764 print(")");
765 }
766 print(";");
767 } catch (IOException e) {
768 throw new UncheckedIOException(e);
769 }
770 }
771
772 public void visitWhileLoop(JCWhileLoop tree) {
773 try {
774 print("while ");
775 if (tree.cond.hasTag(PARENS)) {
776 printExpr(tree.cond);
777 } else {
778 print("(");
779 printExpr(tree.cond);
780 print(")");
781 }
782 print(" ");
783 printStat(tree.body);
784 } catch (IOException e) {
785 throw new UncheckedIOException(e);
786 }
787 }
788
789 public void visitWithField(JCWithField tree) {
790 try {
791 print("__WithField(");
792 printExpr(tree.field);
793 print(", ");
794 printExpr(tree.value);
795 print(")");
796 } catch (IOException e) {
797 throw new UncheckedIOException(e);
798 }
799 }
800
801 public void visitForLoop(JCForLoop tree) {
802 try {
803 print("for (");
804 if (tree.init.nonEmpty()) {
805 if (tree.init.head.hasTag(VARDEF)) {
806 printExpr(tree.init.head);
807 for (List<JCStatement> l = tree.init.tail; l.nonEmpty(); l = l.tail) {
808 JCVariableDecl vdef = (JCVariableDecl)l.head;
809 print(", " + vdef.name);
810 if (vdef.init != null) {
811 print(" = ");
812 printExpr(vdef.init);
813 }
814 }
815 } else {
816 printExprs(tree.init);
817 }
818 }
819 print("; ");
820 if (tree.cond != null) printExpr(tree.cond);
|