diff options
Diffstat (limited to 'src/lombok/eclipse/EclipseASTVisitor.java')
-rw-r--r-- | src/lombok/eclipse/EclipseASTVisitor.java | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/lombok/eclipse/EclipseASTVisitor.java b/src/lombok/eclipse/EclipseASTVisitor.java index aff1cc38..ac4d0e33 100644 --- a/src/lombok/eclipse/EclipseASTVisitor.java +++ b/src/lombok/eclipse/EclipseASTVisitor.java @@ -12,6 +12,7 @@ import org.eclipse.jdt.internal.compiler.ast.ConstructorDeclaration; import org.eclipse.jdt.internal.compiler.ast.FieldDeclaration; import org.eclipse.jdt.internal.compiler.ast.Initializer; import org.eclipse.jdt.internal.compiler.ast.LocalDeclaration; +import org.eclipse.jdt.internal.compiler.ast.Statement; import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration; import org.eclipse.jdt.internal.compiler.ast.TypeReference; @@ -60,6 +61,14 @@ public interface EclipseASTVisitor { void visitLocal(Node node, LocalDeclaration declaration); void endVisitLocal(Node node, LocalDeclaration declaration); + /** + * Visits a statement that isn't any of the other visit methods (e.g. TypeDeclaration). + * @param node + * @param statement + */ + void visitStatement(Node node, Statement statement); + void endVisitStatement(Node node, Statement statement); + public static class EclipseASTPrinter implements EclipseASTVisitor { int indent = 0; private void print(String text, Object... params) { @@ -155,5 +164,15 @@ public interface EclipseASTVisitor { indent--; print("</%s %s %s>", type, str(local.type), str(local.name)); } + + @Override public void visitStatement(Node node, Statement statement) { + print("<%s>", statement.getClass()); + indent++; + } + + @Override public void endVisitStatement(Node node, Statement statement) { + indent--; + print("</%s>", statement.getClass()); + } } } |