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.codegen.Label;
14 import net.sourceforge.phpeclipse.internal.compiler.ast.AstNode;
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.DEAD_END;
24 public SwitchFlowContext(
26 AstNode associatedNode,
28 super(parent, associatedNode);
29 this.breakLabel = breakLabel;
32 public Label breakLabel() {
36 public String individualToString() {
37 StringBuffer buffer = new StringBuffer("Switch flow context"); //$NON-NLS-1$
38 buffer.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.unconditionalInits());