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;
16 * Reflects the context of code analysis, keeping track of enclosing try
17 * statements, exception handlers, etc...
19 public class InsideSubRoutineFlowContext extends FlowContext {
21 public UnconditionalFlowInfo initsOnReturn;
23 public InsideSubRoutineFlowContext(FlowContext parent,
24 ASTNode associatedNode) {
25 super(parent, associatedNode);
26 this.initsOnReturn = FlowInfo.DEAD_END;
29 public String individualToString() {
31 StringBuffer buffer = new StringBuffer("Inside SubRoutine flow context"); //$NON-NLS-1$
33 .append("[initsOnReturn -").append(initsOnReturn.toString()).append(']'); //$NON-NLS-1$
34 return buffer.toString();
37 public UnconditionalFlowInfo initsOnReturn() {
38 return this.initsOnReturn;
41 public boolean isNonReturningContext() {
42 return associatedNode.cannotReturn();
45 public ASTNode subRoutine() {
46 return associatedNode;
49 public void recordReturnFrom(FlowInfo flowInfo) {
51 if (!flowInfo.isReachable())
53 if (initsOnReturn == FlowInfo.DEAD_END) {
54 initsOnReturn = flowInfo.copy().unconditionalInits();
56 initsOnReturn = initsOnReturn.mergedWith(flowInfo
57 .unconditionalInits());