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.flow;
13 import net.sourceforge.phpdt.internal.compiler.ast.ASTNode;
14 import net.sourceforge.phpdt.internal.compiler.codegen.Label;
17 * Reflects the context of code analysis, keeping track of enclosing try
18 * statements, exception handlers, etc...
20 public class SwitchFlowContext extends FlowContext {
21 public Label breakLabel;
23 public UnconditionalFlowInfo initsOnBreak = FlowInfo.DEAD_END;
25 public SwitchFlowContext(FlowContext parent, ASTNode associatedNode,
27 super(parent, associatedNode);
28 this.breakLabel = breakLabel;
31 public Label breakLabel() {
35 public String individualToString() {
36 StringBuffer buffer = new StringBuffer("Switch flow context"); //$NON-NLS-1$
38 .append("[initsOnBreak -").append(initsOnBreak.toString()).append(']'); //$NON-NLS-1$
39 return buffer.toString();
42 public boolean isBreakable() {
46 public void recordBreakFrom(FlowInfo flowInfo) {
48 if (initsOnBreak == FlowInfo.DEAD_END) {
49 initsOnBreak = flowInfo.copy().unconditionalInits();
51 initsOnBreak = initsOnBreak.mergedWith(flowInfo
52 .unconditionalInits());