< prev index next >

src/jdk.jextract/share/classes/com/sun/tools/jextract/tree/TreePrinter.java

Print this page




  69         if (m.isConstant()) {
  70             System.out.printf("Macro %s = %s\n\n", m.name(), m.value().get());
  71         }
  72         return null;
  73     }
  74 
  75     @Override
  76     public Void visitHeader(HeaderTree t, Void v) {
  77         System.out.println("HeaderTree @ " + t.path());
  78         int i = 0;
  79         for (Tree decl : t.declarations()) {
  80             System.out.println("--> header declaration: " + i++);
  81             decl.accept(this, v);
  82         }
  83         return null;
  84     }
  85 
  86     @Override
  87     public Void visitStruct(StructTree s, Void v) {
  88         defaultAction(s, v);
  89         System.out.printf("%s layout = %s\n\n", s.name(), s.layout((ft, l) -> l));

  90         List<? extends FieldTree> fields = s.fields();
  91         if (! fields.isEmpty()) {
  92             System.out.println("--> fields");
  93             for (FieldTree f : fields) {
  94                 f.accept(this, v);
  95             }
  96         }
  97         List<? extends Tree> nested = s.nestedTypes();
  98         if (! nested.isEmpty()) {
  99             System.out.println("--> nested types");
 100             for (Tree nt : nested) {
 101                 nt.accept(this, v);
 102             }
 103         }
 104         return null;
 105     }
 106 
 107     @Override
 108     public Void visitVar(VarTree t, Void v) {
 109         defaultAction(t, v);


  69         if (m.isConstant()) {
  70             System.out.printf("Macro %s = %s\n\n", m.name(), m.value().get());
  71         }
  72         return null;
  73     }
  74 
  75     @Override
  76     public Void visitHeader(HeaderTree t, Void v) {
  77         System.out.println("HeaderTree @ " + t.path());
  78         int i = 0;
  79         for (Tree decl : t.declarations()) {
  80             System.out.println("--> header declaration: " + i++);
  81             decl.accept(this, v);
  82         }
  83         return null;
  84     }
  85 
  86     @Override
  87     public Void visitStruct(StructTree s, Void v) {
  88         defaultAction(s, v);
  89         System.out.printf("name = '%s', isAnonymous? = %b, layout = %s\n\n",
  90             s.name(), s.isAnonymous(), s.layout((ft, l) -> l));
  91         List<? extends FieldTree> fields = s.fields();
  92         if (! fields.isEmpty()) {
  93             System.out.println("--> fields");
  94             for (FieldTree f : fields) {
  95                 f.accept(this, v);
  96             }
  97         }
  98         List<? extends Tree> nested = s.nestedTypes();
  99         if (! nested.isEmpty()) {
 100             System.out.println("--> nested types");
 101             for (Tree nt : nested) {
 102                 nt.accept(this, v);
 103             }
 104         }
 105         return null;
 106     }
 107 
 108     @Override
 109     public Void visitVar(VarTree t, Void v) {
 110         defaultAction(t, v);
< prev index next >