Makefile fixup
[org.ibex.tool.git] / repo / org.ibex.tool / src / org / eclipse / jdt / internal / compiler / ast / BranchStatement.java
1 /*******************************************************************************
2  * Copyright (c) 2000, 2004 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 org.eclipse.jdt.internal.compiler.ast;
12
13 import org.eclipse.jdt.internal.compiler.codegen.*;
14 import org.eclipse.jdt.internal.compiler.lookup.*;
15
16 public abstract class BranchStatement extends Statement {
17         public char[] label;
18         public Label targetLabel;
19         public SubRoutineStatement[] subroutines;
20 /**
21  * BranchStatement constructor comment.
22  */
23 public BranchStatement(char[] l, int s,int e) {
24         label = l ;
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                         SubRoutineStatement sub = subroutines[i];
45                         sub.generateSubRoutineInvocation(currentScope, codeStream);
46                         if (sub.isSubRoutineEscaping()) {
47                                         codeStream.recordPositionsFrom(pc, this.sourceStart);
48                                         SubRoutineStatement.reenterExceptionHandlers(subroutines, i, codeStream);
49                                         return;
50                         }
51                         sub.exitAnyExceptionHandler();
52                 }
53         }
54         codeStream.goto_(targetLabel);
55         codeStream.recordPositionsFrom(pc, this.sourceStart);
56         SubRoutineStatement.reenterExceptionHandlers(subroutines, -1, codeStream);
57 }
58 public void resolve(BlockScope scope) {
59         // nothing to do during name resolution
60 }
61
62 }