*******************************************************************************/
package net.sourceforge.phpeclipse.internal.compiler.ast;
-import net.sourceforge.phpdt.internal.compiler.IAbstractSyntaxTreeVisitor;
-import net.sourceforge.phpdt.internal.compiler.codegen.Label;
+import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
import net.sourceforge.phpdt.internal.compiler.impl.Constant;
public Expression condition;
public Statement thenStatement;
public Statement elseStatement;
-
+ public Expression[] elseifConditions;
+ public Statement[] elseifStatements;
+ public boolean checkUnreachable;
boolean thenExit;
+
// for local variables table attributes
int thenInitStateIndex = -1;
this.thenStatement = thenStatement;
sourceStart = s;
sourceEnd = e;
+ checkUnreachable = true;
}
public IfStatement(
this.elseStatement = elseStatement;
sourceEnd = e;
sourceStart = s;
+ checkUnreachable = true;
}
public FlowInfo analyseCode(
/**
* If 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) {
//
// }
// codeStream.recordPositionsFrom(pc, this.sourceStart);
// }
+ public StringBuffer printStatement(int indent, StringBuffer output) {
+ printIndent(indent, output).append("if ("); //$NON-NLS-1$
+ condition.printExpression(0, output).append(")\n"); //$NON-NLS-1$
+ thenStatement.printStatement(indent + 2, output);
+ if (elseStatement != null) {
+ output.append('\n');
+ printIndent(indent, output);
+ output.append("else\n"); //$NON-NLS-1$
+ elseStatement.printStatement(indent + 2, output);
+ }
+ return output;
+ }
public void resolve(BlockScope scope) {
TypeBinding type = condition.resolveTypeExpecting(scope, BooleanBinding);
}
public void traverse(
- IAbstractSyntaxTreeVisitor visitor,
+ ASTVisitor visitor,
BlockScope blockScope) {
if (visitor.visit(this, blockScope)) {