Show line numbers (other than 1) in problems view for errors and warnings
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpeclipse / internal / compiler / ast / BreakStatement.java
index 2c657e6..d56fc43 100644 (file)
@@ -17,8 +17,8 @@ import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
 
 public class BreakStatement extends BranchStatement {
        
-       public BreakStatement(char[] label, int sourceStart, int e) {
-               super(label, sourceStart, e);
+       public BreakStatement(Expression expr, int sourceStart, int e) {
+               super(expr, sourceStart, e);
        }
 
        public FlowInfo analyseCode(
@@ -30,52 +30,52 @@ public class BreakStatement extends BranchStatement {
                // to each of the traversed try statements, so that execution will terminate properly.
 
                // lookup the label, this should answer the returnContext
-               FlowContext targetContext = (label == null) 
-                       ? flowContext.getTargetContextForDefaultBreak()
-                       : flowContext.getTargetContextForBreakLabel(label);
-
-               if (targetContext == null) {
-                       if (label == null) {
-                               currentScope.problemReporter().invalidBreak(this);
-                       } else {
-                               currentScope.problemReporter().undefinedLabel(this); 
-                       }
-                       return flowInfo; // pretend it did not break since no actual target
-               }
-               
-               targetLabel = targetContext.breakLabel();
-               FlowContext traversedContext = flowContext;
-               int subIndex = 0, maxSub = 5;
-               subroutines = new ASTNode[maxSub];
-               
-               do {
-                       ASTNode sub;
-                       if ((sub = traversedContext.subRoutine()) != null) {
-                               if (subIndex == maxSub) {
-                                       System.arraycopy(subroutines, 0, (subroutines = new ASTNode[maxSub*=2]), 0, subIndex); // grow
-                               }
-                               subroutines[subIndex++] = sub;
-                               if (sub.cannotReturn()) {
-                                       break;
-                               }
-                       }
-                       traversedContext.recordReturnFrom(flowInfo.unconditionalInits());
-
-                       ASTNode node;
-                       if ((node = traversedContext.associatedNode) instanceof TryStatement) {
-                               TryStatement tryStatement = (TryStatement) node;
-                               flowInfo.addInitializationsFrom(tryStatement.subRoutineInits); // collect inits                 
-                       } else if (traversedContext == targetContext) {
-                               // only record break info once accumulated through subroutines, and only against target context
-                               targetContext.recordBreakFrom(flowInfo);
-                               break;
-                       }
-               } while ((traversedContext = traversedContext.parent) != null);
-               
-               // resize subroutines
-               if (subIndex != maxSub) {
-                       System.arraycopy(subroutines, 0, (subroutines = new ASTNode[subIndex]), 0, subIndex);
-               }
+//             FlowContext targetContext = (label == null) 
+//                     ? flowContext.getTargetContextForDefaultBreak()
+//                     : flowContext.getTargetContextForBreakLabel(label);
+//
+//             if (targetContext == null) {
+//                     if (label == null) {
+//                             currentScope.problemReporter().invalidBreak(this);
+//                     } else {
+//                             currentScope.problemReporter().undefinedLabel(this); 
+//                     }
+//                     return flowInfo; // pretend it did not break since no actual target
+//             }
+//             
+//             targetLabel = targetContext.breakLabel();
+//             FlowContext traversedContext = flowContext;
+//             int subIndex = 0, maxSub = 5;
+//             subroutines = new ASTNode[maxSub];
+//             
+//             do {
+//                     ASTNode sub;
+//                     if ((sub = traversedContext.subRoutine()) != null) {
+//                             if (subIndex == maxSub) {
+//                                     System.arraycopy(subroutines, 0, (subroutines = new ASTNode[maxSub*=2]), 0, subIndex); // grow
+//                             }
+//                             subroutines[subIndex++] = sub;
+//                             if (sub.cannotReturn()) {
+//                                     break;
+//                             }
+//                     }
+//                     traversedContext.recordReturnFrom(flowInfo.unconditionalInits());
+//
+//                     ASTNode node;
+//                     if ((node = traversedContext.associatedNode) instanceof TryStatement) {
+//                             TryStatement tryStatement = (TryStatement) node;
+//                             flowInfo.addInitializationsFrom(tryStatement.subRoutineInits); // collect inits                 
+//                     } else if (traversedContext == targetContext) {
+//                             // only record break info once accumulated through subroutines, and only against target context
+//                             targetContext.recordBreakFrom(flowInfo);
+//                             break;
+//                     }
+//             } while ((traversedContext = traversedContext.parent) != null);
+//             
+//             // resize subroutines
+//             if (subIndex != maxSub) {
+//                     System.arraycopy(subroutines, 0, (subroutines = new ASTNode[subIndex]), 0, subIndex);
+//             }
                return FlowInfo.DEAD_END;
        }
        
@@ -83,14 +83,14 @@ public class BreakStatement extends BranchStatement {
 
                String s = tabString(tab);
                s += "break "; //$NON-NLS-1$
-               if (label != null)
-                       s += new String(label);
+               if (expression != null)
+                       s += expression.toString();
                return s;
        }
        public StringBuffer printStatement(int tab, StringBuffer output) {
 
                printIndent(tab, output).append("break "); //$NON-NLS-1$
-               if (label != null) output.append(label);
+               if (expression != null) output.append(expression);
                return output.append(';');
        }
        public void traverse(