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.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
18 * try statements, exception handlers, etc...
20 public class SwitchFlowContext extends FlowContext {
21 public Label breakLabel;
22 public UnconditionalFlowInfo initsOnBreak = FlowInfo.DeadEnd;
24 public SwitchFlowContext(
26 AstNode associatedNode,
28 super(parent, associatedNode);
29 this.breakLabel = breakLabel;
32 public Label breakLabel() {
36 public String individualToString() {
37 return "Switch flow context"; //$NON-NLS-1$
40 public boolean isBreakable() {
44 public void recordBreakFrom(FlowInfo flowInfo) {
45 if (initsOnBreak == FlowInfo.DeadEnd) {
46 initsOnBreak = flowInfo.copy().unconditionalInits();
48 // ignore if not really reachable (1FKEKRP)
49 if (flowInfo.isFakeReachable())
51 initsOnBreak.mergedWith(flowInfo.unconditionalInits());