*******************************************************************************/
package net.sourceforge.phpeclipse.internal.compiler.ast;
-import net.sourceforge.phpdt.internal.compiler.IAbstractSyntaxTreeVisitor;
+import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
import net.sourceforge.phpdt.internal.compiler.codegen.Label;
import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
/**
* For statement code generation
*
- * @param currentScope org.eclipse.jdt.internal.compiler.lookup.BlockScope
- * @param codeStream org.eclipse.jdt.internal.compiler.codegen.CodeStream
+ * @param currentScope net.sourceforge.phpdt.internal.compiler.lookup.BlockScope
+ * @param codeStream net.sourceforge.phpdt.internal.compiler.codegen.CodeStream
*/
// public void generateCode(BlockScope currentScope, CodeStream codeStream) {
//
this.continueLabel.resetStateForCodeGeneration();
}
}
+ public StringBuffer printStatement(int tab, StringBuffer output) {
+ printIndent(tab, output).append("for ("); //$NON-NLS-1$
+ //inits
+ if (initializations != null) {
+ for (int i = 0; i < initializations.length; i++) {
+ //nice only with expressions
+ if (i > 0) output.append(", "); //$NON-NLS-1$
+ initializations[i].print(0, output);
+ }
+ }
+ output.append("; "); //$NON-NLS-1$
+ //cond
+ if (condition != null) condition.printExpression(0, output);
+ output.append("; "); //$NON-NLS-1$
+ //updates
+ if (increments != null) {
+ for (int i = 0; i < increments.length; i++) {
+ if (i > 0) output.append(", "); //$NON-NLS-1$
+ increments[i].print(0, output);
+ }
+ }
+ output.append(") "); //$NON-NLS-1$
+ //block
+ if (action == null)
+ output.append(';');
+ else {
+ output.append('\n');
+ action.printStatement(tab + 1, output); //$NON-NLS-1$
+ }
+ return output.append(';');
+ }
public void resolve(BlockScope upperScope) {
// use the scope that will hold the init declarations
}
public void traverse(
- IAbstractSyntaxTreeVisitor visitor,
+ ASTVisitor visitor,
BlockScope blockScope) {
if (visitor.visit(this, blockScope)) {