01: /*******************************************************************************
02: * Copyright (c) 2000, 2006 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.jdt.internal.compiler.flow;
11:
12: import org.eclipse.jdt.internal.compiler.ast.ASTNode;
13: import org.eclipse.jdt.internal.compiler.codegen.BranchLabel;
14:
15: /**
16: * Reflects the context of code analysis, keeping track of enclosing
17: * try statements, exception handlers, etc...
18: */
19: public class SwitchFlowContext extends FlowContext {
20:
21: public BranchLabel breakLabel;
22: public UnconditionalFlowInfo initsOnBreak = FlowInfo.DEAD_END;
23:
24: public SwitchFlowContext(FlowContext parent,
25: ASTNode associatedNode, BranchLabel breakLabel) {
26: super (parent, associatedNode);
27: this .breakLabel = breakLabel;
28: }
29:
30: public BranchLabel breakLabel() {
31: return breakLabel;
32: }
33:
34: public String individualToString() {
35: StringBuffer buffer = new StringBuffer("Switch flow context"); //$NON-NLS-1$
36: buffer
37: .append("[initsOnBreak -").append(initsOnBreak.toString()).append(']'); //$NON-NLS-1$
38: return buffer.toString();
39: }
40:
41: public boolean isBreakable() {
42: return true;
43: }
44:
45: public void recordBreakFrom(FlowInfo flowInfo) {
46: if ((initsOnBreak.tagBits & FlowInfo.UNREACHABLE) == 0) {
47: initsOnBreak = initsOnBreak.mergedWith(flowInfo
48: .unconditionalInits());
49: } else {
50: initsOnBreak = flowInfo.unconditionalCopy();
51: }
52: }
53: }
|