package net.sourceforge.phpdt.internal.compiler.ast;
/**
+ * A For statement.
+ * for(initializations;condition;increments) action
* @author Matthieu Casanova
*/
public class ForStatement extends Statement {
- public Statement[] initializations;
+ /** the initializations. */
+ public Expression[] initializations;
+
+ /** the condition. */
public Expression condition;
- public Statement[] increments;
+ /** the increments. */
+ public Expression[] increments;
+
public Statement action;
- public ForStatement(Statement[] initializations,
+ public ForStatement(Expression[] initializations,
Expression condition,
- Statement[] increments,
+ Expression[] increments,
Statement action,
int sourceStart,
int sourceEnd) {
//inits
if (initializations != null) {
for (int i = 0; i < initializations.length; i++) {
- //nice only with expressions
- buff.append(initializations[i].toString());
+ buff.append(initializations[i].toStringExpression());
if (i != (initializations.length - 1))
buff.append(" , "); //$NON-NLS-1$
}
if (increments != null) {
for (int i = 0; i < increments.length; i++) {
//nice only with expressions
- buff.append(increments[i].toString());
+ buff.append(increments[i].toStringExpression());
if (i != (increments.length - 1))
buff.append(" , "); //$NON-NLS-1$
}
if (action == null)
buff.append("{}"); //$NON-NLS-1$
else
- buff.append( "\n").append(action.toString(tab + 1)); //$NON-NLS-1$
+ buff.append(action.toString(tab + 1)); //$NON-NLS-1$
return buff.toString();
}
}