avoid NullPointerException in debug
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / compiler / ast / BranchStatement.java
1 /*******************************************************************************
2  * Copyright (c) 2000, 2003 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials 
4  * are made available under the terms of the Common Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/cpl-v10.html
7  * 
8  * Contributors:
9  *     IBM Corporation - initial API and implementation
10  *******************************************************************************/
11 package net.sourceforge.phpdt.internal.compiler.ast;
12
13 import net.sourceforge.phpdt.internal.compiler.codegen.Label;
14 import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
15
16 public abstract class BranchStatement extends Statement {
17     public Expression expression;
18         public Label targetLabel;
19         public ASTNode[] subroutines;
20 /**
21  * BranchStatement constructor comment.
22  */
23 public BranchStatement(Expression expr, int s,int e) {
24         expression = expr ;
25         sourceStart = s;
26         sourceEnd = e;
27 }
28 /**
29  * Branch code generation
30  *
31  *   generate the finallyInvocationSequence.
32  */
33 //public void generateCode(BlockScope currentScope, CodeStream codeStream) {
34 //
35 //      if ((bits & IsReachableMASK) == 0) {
36 //              return;
37 //      }
38 //      int pc = codeStream.position;
39 //
40 //      // generation of code responsible for invoking the finally 
41 //      // blocks in sequence
42 //      if (subroutines != null){
43 //              for (int i = 0, max = subroutines.length; i < max; i++){
44 //                      ASTNode sub;
45 //                      if ((sub = subroutines[i]) instanceof SynchronizedStatement){
46 //                              codeStream.load(((SynchronizedStatement)sub).synchroVariable);
47 //                              codeStream.monitorexit(); 
48 //                      } else {
49 //                              TryStatement trySub = (TryStatement) sub;
50 //                              if (trySub.subRoutineCannotReturn)      {
51 //                                      codeStream.goto_(trySub.subRoutineStartLabel);
52 //                                      codeStream.recordPositionsFrom(pc, this.sourceStart);
53 //                                      return;
54 //                              } else {
55 //                                      codeStream.jsr(trySub.subRoutineStartLabel);
56 //                              }
57 //                      }
58 //              }
59 //      }
60 //      codeStream.goto_(targetLabel);
61 //      codeStream.recordPositionsFrom(pc, this.sourceStart);
62 //}
63 public void resetStateForCodeGeneration() {
64         if (this.targetLabel != null) {
65                 this.targetLabel.resetStateForCodeGeneration();
66         }
67 }
68
69 public void resolve(BlockScope scope) {
70 }
71
72 }