Applying pteague's patch (re #685)
[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
19         public Label targetLabel;
20
21         public ASTNode[] subroutines;
22
23         /**
24          * BranchStatement constructor comment.
25          */
26         public BranchStatement(Expression expr, int s, int e) {
27                 expression = expr;
28                 sourceStart = s;
29                 sourceEnd = e;
30         }
31
32         /**
33          * Branch code generation
34          * 
35          * generate the finallyInvocationSequence.
36          */
37         // public void generateCode(BlockScope currentScope, CodeStream codeStream)
38         // {
39         //
40         // if ((bits & IsReachableMASK) == 0) {
41         // return;
42         // }
43         // int pc = codeStream.position;
44         //
45         // // generation of code responsible for invoking the finally
46         // // blocks in sequence
47         // if (subroutines != null){
48         // for (int i = 0, max = subroutines.length; i < max; i++){
49         // ASTNode sub;
50         // if ((sub = subroutines[i]) instanceof SynchronizedStatement){
51         // codeStream.load(((SynchronizedStatement)sub).synchroVariable);
52         // codeStream.monitorexit();
53         // } else {
54         // TryStatement trySub = (TryStatement) sub;
55         // if (trySub.subRoutineCannotReturn) {
56         // codeStream.goto_(trySub.subRoutineStartLabel);
57         // codeStream.recordPositionsFrom(pc, this.sourceStart);
58         // return;
59         // } else {
60         // codeStream.jsr(trySub.subRoutineStartLabel);
61         // }
62         // }
63         // }
64         // }
65         // codeStream.goto_(targetLabel);
66         // codeStream.recordPositionsFrom(pc, this.sourceStart);
67         // }
68         public void resetStateForCodeGeneration() {
69                 if (this.targetLabel != null) {
70                         this.targetLabel.resetStateForCodeGeneration();
71                 }
72         }
73
74         public void resolve(BlockScope scope) {
75         }
76
77 }