1 /*******************************************************************************
2 * Copyright (c) 2000, 2001, 2002 International Business Machines Corp. and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Common Public License v0.5
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/cpl-v05.html
9 * IBM Corporation - initial API and implementation
10 ******************************************************************************/
11 package net.sourceforge.phpdt.internal.compiler.ast;
13 import net.sourceforge.phpdt.internal.compiler.codegen.*;
14 import net.sourceforge.phpdt.internal.compiler.lookup.*;
16 public abstract class BranchStatement extends Statement {
18 public Label targetLabel;
19 public AstNode[] subroutines;
21 * BranchStatement constructor comment.
23 public BranchStatement(char[] l, int s,int e) {
29 * Branch code generation
31 * generate the finallyInvocationSequence.
33 public void generateCode(BlockScope currentScope, CodeStream codeStream) {
35 if ((bits & IsReachableMASK) == 0) {
38 int pc = codeStream.position;
40 // generation of code responsible for invoking the finally
42 if (subroutines != null){
43 for (int i = 0, max = subroutines.length; i < max; i++){
45 if ((sub = subroutines[i]) instanceof SynchronizedStatement){
46 codeStream.load(((SynchronizedStatement)sub).synchroVariable);
47 codeStream.monitorexit();
49 TryStatement trySub = (TryStatement) sub;
50 if (trySub.subRoutineCannotReturn) {
51 codeStream.goto_(trySub.subRoutineStartLabel);
52 codeStream.recordPositionsFrom(pc, this.sourceStart);
55 codeStream.jsr(trySub.subRoutineStartLabel);
60 codeStream.goto_(targetLabel);
61 codeStream.recordPositionsFrom(pc, this.sourceStart);
63 public void resetStateForCodeGeneration() {
64 this.targetLabel.resetStateForCodeGeneration();