src/jdk.compiler/share/classes/com/sun/tools/javac/tree/Pretty.java
changeset 59285 7799a51dbe30
parent 58713 ad69fd32778e
equal deleted inserted replaced
59284:88502b1cf76f 59285:7799a51dbe30
   230 
   230 
   231     /** Derived visitor method: print list of expression trees, separated by commas.
   231     /** Derived visitor method: print list of expression trees, separated by commas.
   232      */
   232      */
   233     public <T extends JCTree> void printExprs(List<T> trees) throws IOException {
   233     public <T extends JCTree> void printExprs(List<T> trees) throws IOException {
   234         printExprs(trees, ", ");
   234         printExprs(trees, ", ");
       
   235     }
       
   236 
       
   237 
       
   238     /** Derived visitor method: print pattern.
       
   239      */
       
   240 
       
   241     public void printPattern(JCTree tree) throws IOException {
       
   242         printExpr(tree);
   235     }
   243     }
   236 
   244 
   237     /** Derived visitor method: print list of statements, each on a separate line.
   245     /** Derived visitor method: print list of statements, each on a separate line.
   238      */
   246      */
   239     public void printStats(List<? extends JCTree> trees) throws IOException {
   247     public void printStats(List<? extends JCTree> trees) throws IOException {
   875         } catch (IOException e) {
   883         } catch (IOException e) {
   876             throw new UncheckedIOException(e);
   884             throw new UncheckedIOException(e);
   877         }
   885         }
   878     }
   886     }
   879 
   887 
       
   888     public void visitBindingPattern(JCBindingPattern patt) {
       
   889         try {
       
   890             printExpr(patt.vartype);
       
   891             print(" ");
       
   892             print(patt.name);
       
   893         } catch (IOException e) {
       
   894             throw new UncheckedIOException(e);
       
   895         }
       
   896     }
       
   897 
   880     public void visitSynchronized(JCSynchronized tree) {
   898     public void visitSynchronized(JCSynchronized tree) {
   881         try {
   899         try {
   882             print("synchronized ");
   900             print("synchronized ");
   883             if (tree.lock.hasTag(PARENS)) {
   901             if (tree.lock.hasTag(PARENS)) {
   884                 printExpr(tree.lock);
   902                 printExpr(tree.lock);
  1281     public void visitTypeTest(JCInstanceOf tree) {
  1299     public void visitTypeTest(JCInstanceOf tree) {
  1282         try {
  1300         try {
  1283             open(prec, TreeInfo.ordPrec);
  1301             open(prec, TreeInfo.ordPrec);
  1284             printExpr(tree.expr, TreeInfo.ordPrec);
  1302             printExpr(tree.expr, TreeInfo.ordPrec);
  1285             print(" instanceof ");
  1303             print(" instanceof ");
  1286             printExpr(tree.clazz, TreeInfo.ordPrec + 1);
  1304             if (tree.pattern instanceof JCPattern) {
       
  1305                 printPattern(tree.pattern);
       
  1306             } else {
       
  1307                 printExpr(tree.getType(), TreeInfo.ordPrec + 1);
       
  1308             }
  1287             close(prec, TreeInfo.ordPrec);
  1309             close(prec, TreeInfo.ordPrec);
  1288         } catch (IOException e) {
  1310         } catch (IOException e) {
  1289             throw new UncheckedIOException(e);
  1311             throw new UncheckedIOException(e);
  1290         }
  1312         }
  1291     }
  1313     }