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
9 * IBM Corporation - initial API and implementation
10 *******************************************************************************/
11 package net.sourceforge.phpdt.internal.compiler.ast;
13 import net.sourceforge.phpdt.internal.compiler.codegen.Label;
14 import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
16 public abstract class BranchStatement extends Statement {
17 public Expression expression;
19 public Label targetLabel;
21 public ASTNode[] subroutines;
24 * BranchStatement constructor comment.
26 public BranchStatement(Expression expr, int s, int e) {
33 * Branch code generation
35 * generate the finallyInvocationSequence.
37 // public void generateCode(BlockScope currentScope, CodeStream codeStream)
40 // if ((bits & IsReachableMASK) == 0) {
43 // int pc = codeStream.position;
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++){
50 // if ((sub = subroutines[i]) instanceof SynchronizedStatement){
51 // codeStream.load(((SynchronizedStatement)sub).synchroVariable);
52 // codeStream.monitorexit();
54 // TryStatement trySub = (TryStatement) sub;
55 // if (trySub.subRoutineCannotReturn) {
56 // codeStream.goto_(trySub.subRoutineStartLabel);
57 // codeStream.recordPositionsFrom(pc, this.sourceStart);
60 // codeStream.jsr(trySub.subRoutineStartLabel);
65 // codeStream.goto_(targetLabel);
66 // codeStream.recordPositionsFrom(pc, this.sourceStart);
68 public void resetStateForCodeGeneration() {
69 if (this.targetLabel != null) {
70 this.targetLabel.resetStateForCodeGeneration();
74 public void resolve(BlockScope scope) {