A variable description (like PHPFunctionDeclaration)
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / compiler / flow / InsideSubRoutineFlowContext.java
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
7  * 
8  * Contributors:
9  *     IBM Corporation - initial API and implementation
10  ******************************************************************************/
11 package net.sourceforge.phpdt.internal.compiler.flow;
12
13 import net.sourceforge.phpdt.internal.compiler.ast.AstNode;
14
15 /**
16  * Reflects the context of code analysis, keeping track of enclosing
17  *      try statements, exception handlers, etc...
18  */
19 public class InsideSubRoutineFlowContext extends FlowContext {
20
21         public UnconditionalFlowInfo initsOnReturn;
22         
23         public InsideSubRoutineFlowContext(
24                 FlowContext parent,
25                 AstNode associatedNode) {
26                 super(parent, associatedNode);
27                 this.initsOnReturn = FlowInfo.DeadEnd;                          
28         }
29         
30         public boolean isNonReturningContext() {
31                 return associatedNode.cannotReturn();
32         }
33         
34         public AstNode subRoutine() {
35                 return associatedNode;
36         }
37         
38         public void recordReturnFrom(UnconditionalFlowInfo flowInfo) {
39                 // record initializations which were performed at the return point
40                 initsOnReturn = initsOnReturn.mergedWith(flowInfo);
41         }
42 }