improved PHP parser
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpeclipse / internal / compiler / ast / TryStatement.java
index 8eca475..b2a2c71 100644 (file)
@@ -10,7 +10,7 @@
  *******************************************************************************/
 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.ExceptionHandlingFlowContext;
 import net.sourceforge.phpdt.internal.compiler.flow.FinallyFlowContext;
@@ -119,7 +119,7 @@ public class TryStatement extends Statement {
                }
 
                // check unreachable catch blocks
-               handlingContext.complainIfUnusedExceptionHandlers(catchBlocks, scope, this);
+//             handlingContext.complainIfUnusedExceptionHandlers(catchBlocks, scope, this);
 
                // process the catch blocks - computing the minimal exit depth amongst try/catch
                if (catchArguments != null) {
@@ -407,7 +407,27 @@ public class TryStatement extends Statement {
                        this.subRoutineStartLabel.resetStateForCodeGeneration();
                }
        }       
+       public StringBuffer printStatement(int indent, StringBuffer output) {
+               printIndent(indent, output).append("try \n"); //$NON-NLS-1$
+               tryBlock.printStatement(indent + 1, output); //$NON-NLS-1$
 
+               //catches
+               if (catchBlocks != null)
+                       for (int i = 0; i < catchBlocks.length; i++) {
+                                       output.append('\n');
+                                       printIndent(indent, output).append("catch ("); //$NON-NLS-1$
+                                       catchArguments[i].print(0, output).append(") "); //$NON-NLS-1$
+                                       catchBlocks[i].printStatement(indent + 1, output);
+                       }
+               //finally
+               if (finallyBlock != null) {
+                       output.append('\n');
+                       printIndent(indent, output).append("finally\n"); //$NON-NLS-1$
+                       finallyBlock.printStatement(indent + 1, output);
+               }
+
+               return output;
+       }
        public void resolve(BlockScope upperScope) {
 
                // special scope for secret locals optimization.        
@@ -527,7 +547,7 @@ public class TryStatement extends Statement {
        }
 
        public void traverse(
-               IAbstractSyntaxTreeVisitor visitor,
+           ASTVisitor visitor,
                BlockScope blockScope) {
 
                if (visitor.visit(this, blockScope)) {