- added include declarations to Outline view
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpeclipse / internal / compiler / ast / Statement.java
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
7  * 
8  * Contributors:
9  *     IBM Corporation - initial API and implementation
10  *******************************************************************************/
11 package net.sourceforge.phpeclipse.internal.compiler.ast;
12
13 import net.sourceforge.phpdt.internal.compiler.codegen.Label;
14 import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
15 import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
16 import net.sourceforge.phpdt.internal.compiler.impl.Constant;
17 import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
18 import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
19
20
21 public abstract class Statement extends AstNode {
22         
23         /**
24          * Statement constructor comment.
25          */ 
26         public Statement() {
27                 super();
28         }
29         
30         public abstract FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo);
31         
32 //      public abstract void generateCode(BlockScope currentScope, CodeStream codeStream);
33         
34         public boolean isEmptyBlock() {
35                 return false;
36         }
37         
38         public boolean isValidJavaStatement() {
39                 //the use of this method should be avoid in most cases
40                 //and is here mostly for documentation purpose.....
41                 //while the parser is responsable for creating
42                 //welled formed expression statement, which results
43                 //in the fact that java-non-semantic-expression-used-as-statement
44                 //should not be parsable...thus not being built.
45                 //It sounds like the java grammar as help the compiler job in removing
46                 //-by construction- some statement that would have no effect....
47                 //(for example all expression that may do side-effects are valid statement
48                 // -this is an appromative idea.....-)
49
50                 return true;
51         }
52         
53         public abstract void resolve(BlockScope scope);
54         
55         public Constant resolveCase(BlockScope scope, TypeBinding testType, SwitchStatement switchStatement) {
56                 // statement within a switch that are not case are treated as normal statement.... 
57
58                 resolve(scope);
59                 return null;
60         }
61         
62         public void resetStateForCodeGeneration() {
63         }
64         
65         /**
66          * INTERNAL USE ONLY.
67          * Do nothing by default. This is used to redirect inter-statements jumps.
68          */
69         public void branchChainTo(Label label) {
70         }
71 }