Example usage for org.eclipse.jdt.internal.compiler.ast Statement toString

List of usage examples for org.eclipse.jdt.internal.compiler.ast Statement toString

Introduction

In this page you can find the example usage for org.eclipse.jdt.internal.compiler.ast Statement toString.

Prototype

@Override
    public String toString() 

Source Link

Usage

From source file:ch.uzh.ifi.seal.changedistiller.ast.java.JavaMethodBodyConverter.java

License:Apache License

@Override
public boolean visit(ForStatement forStatement, BlockScope scope) {
    preVisit(forStatement);//from w  ww . j a v a 2s. co m
    // loop condition
    String value = "";
    if (forStatement.condition != null) {
        value = forStatement.condition.toString();
    }
    pushValuedNode(forStatement, value);
    forStatement.action.traverse(this, scope);

    // loop init
    if (forStatement.initializations != null && forStatement.initializations.length > 0) {
        for (Statement initStatement : forStatement.initializations) {
            push(JavaEntityType.FOR_INIT, initStatement.toString(), initStatement.sourceStart(),
                    initStatement.sourceEnd());

            initStatement.traverse(this, scope);

            pop(initStatement);
        }
    }

    // loop afterthought
    if (forStatement.increments != null && forStatement.increments.length > 0) {
        for (Statement incrementStatement : forStatement.increments) {
            push(JavaEntityType.FOR_INCR, incrementStatement.toString(), incrementStatement.sourceStart(),
                    incrementStatement.sourceEnd());

            incrementStatement.traverse(this, scope);

            pop(incrementStatement);
        }
    }

    return false;
}