improved PHP parser
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpeclipse / internal / compiler / ast / ConditionalExpression.java
index dabfd54..4472c01 100644 (file)
  *******************************************************************************/
 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.flow.UnconditionalFlowInfo;
 import net.sourceforge.phpdt.internal.compiler.impl.Constant;
-import net.sourceforge.phpdt.internal.compiler.lookup.BaseTypeBinding;
 import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
-import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
 
 public class ConditionalExpression extends OperatorExpression {
 
@@ -116,8 +113,8 @@ public class ConditionalExpression extends OperatorExpression {
        /**
         * Code generation for the conditional operator ?:
         *
-        * @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
         * @param valueRequired boolean
        */
 //     public void generateCode(
@@ -407,14 +404,19 @@ public class ConditionalExpression extends OperatorExpression {
 //                     valueIfFalseType);
 //             return null;
 //     }
-       
+       public StringBuffer printExpressionNoParenthesis(int indent, StringBuffer output) {
+               
+               condition.printExpression(indent, output).append(" ? "); //$NON-NLS-1$
+               valueIfTrue.printExpression(0, output).append(" : "); //$NON-NLS-1$
+               return valueIfFalse.printExpression(0, output);
+       }
        public String toStringExpressionNoParenthesis() {
                return condition.toStringExpression() + " ? " + //$NON-NLS-1$
                valueIfTrue.toStringExpression() + " : " + //$NON-NLS-1$
                valueIfFalse.toStringExpression();
        }
 
-       public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope scope) {
+       public void traverse(ASTVisitor visitor, BlockScope scope) {
                if (visitor.visit(this, scope)) {
                        condition.traverse(visitor, scope);
                        valueIfTrue.traverse(visitor, scope);