Changes:
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / compiler / ast / BranchStatement.java
index b28486a..d64a352 100644 (file)
@@ -1,66 +1,44 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2001, 2002 International Business Machines Corp. and others.
- * All rights reserved. This program and the accompanying materials 
- * are made available under the terms of the Common Public License v0.5 
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v05.html
- * 
- * Contributors:
- *     IBM Corporation - initial API and implementation
- ******************************************************************************/
 package net.sourceforge.phpdt.internal.compiler.ast;
 
-import net.sourceforge.phpdt.internal.compiler.codegen.*;
-import net.sourceforge.phpdt.internal.compiler.lookup.*;
+import java.util.List;
 
-public abstract class BranchStatement extends Statement {
-       public char[] label;
-       public Label targetLabel;
-       public AstNode[] subroutines;
 /**
- * BranchStatement constructor comment.
+ * Here is a branchstatement : break or continue
+ * @author Matthieu Casanova
  */
-public BranchStatement(char[] l, int s,int e) {
-       label = l ;
-       sourceStart = s;
-       sourceEnd = e;
-}
-/**
- * Branch code generation
- *
- *   generate the finallyInvocationSequence.
- */
-public void generateCode(BlockScope currentScope, CodeStream codeStream) {
+public abstract class BranchStatement extends Statement {
 
-       if ((bits & IsReachableMASK) == 0) {
-               return;
-       }
-       int pc = codeStream.position;
+  public Expression expression;
 
-       // generation of code responsible for invoking the finally 
-       // blocks in sequence
-       if (subroutines != null){
-               for (int i = 0, max = subroutines.length; i < max; i++){
-                       AstNode sub;
-                       if ((sub = subroutines[i]) instanceof SynchronizedStatement){
-                               codeStream.load(((SynchronizedStatement)sub).synchroVariable);
-                               codeStream.monitorexit(); 
-                       } else {
-                               TryStatement trySub = (TryStatement) sub;
-                               if (trySub.subRoutineCannotReturn)      {
-                                       codeStream.goto_(trySub.subRoutineStartLabel);
-                                       codeStream.recordPositionsFrom(pc, this.sourceStart);
-                                       return;
-                               } else {
-                                       codeStream.jsr(trySub.subRoutineStartLabel);
-                               }
-                       }
-               }
-       }
-       codeStream.goto_(targetLabel);
-       codeStream.recordPositionsFrom(pc, this.sourceStart);
-}
-public void resetStateForCodeGeneration() {
-       this.targetLabel.resetStateForCodeGeneration();
-}
+  public BranchStatement(final Expression expression, final int sourceStart, final int sourceEnd) {
+    super(sourceStart, sourceEnd);
+    this.expression = expression;
+  }
+
+  /**
+   * Get the variables from outside (parameters, globals ...)
+   */
+  public void getOutsideVariable(final List list) {
+    if (expression != null) {
+      expression.getOutsideVariable(list);
+    }
+  }
+
+  /**
+   * get the modified variables.
+   */
+  public void getModifiedVariable(final List list) {
+    if (expression != null) {
+    expression.getModifiedVariable(list);
+    }
+  }
+
+  /**
+   * Get the variables used.
+   */
+  public void getUsedVariable(final List list) {
+    if (expression != null) {
+      expression.getUsedVariable(list);
+    }
+  }
 }