1) Moved net.sourceforge.phpeclipse.ui\src\net\sourceforge\phpdt back to net.sourcefo...
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / 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.phpdt.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 public abstract class Statement extends ASTNode {
21
22         /**
23          * Statement constructor comment.
24          */
25         public Statement() {
26                 super();
27         }
28
29         public abstract FlowInfo analyseCode(BlockScope currentScope,
30                         FlowContext flowContext, FlowInfo flowInfo);
31
32         // public abstract void generateCode(BlockScope currentScope, CodeStream
33         // codeStream);
34
35         public boolean isEmptyBlock() {
36                 return false;
37         }
38
39         public boolean isValidJavaStatement() {
40                 // the use of this method should be avoid in most cases
41                 // and is here mostly for documentation purpose.....
42                 // while the parser is responsable for creating
43                 // welled formed expression statement, which results
44                 // in the fact that java-non-semantic-expression-used-as-statement
45                 // should not be parsable...thus not being built.
46                 // It sounds like the java grammar as help the compiler job in removing
47                 // -by construction- some statement that would have no effect....
48                 // (for example all expression that may do side-effects are valid
49                 // statement
50                 // -this is an appromative idea.....-)
51
52                 return true;
53         }
54
55         public StringBuffer print(int indent, StringBuffer output) {
56                 return printStatement(indent, output);
57         }
58
59         public abstract StringBuffer printStatement(int indent, StringBuffer output);
60
61         public abstract void resolve(BlockScope scope);
62
63         public Constant resolveCase(BlockScope scope, TypeBinding testType,
64                         SwitchStatement switchStatement) {
65                 // statement within a switch that are not case are treated as normal
66                 // statement....
67
68                 resolve(scope);
69                 return null;
70         }
71
72         public void resetStateForCodeGeneration() {
73         }
74
75         /**
76          * INTERNAL USE ONLY. Do nothing by default. This is used to redirect
77          * inter-statements jumps.
78          */
79         public void branchChainTo(Label label) {
80         }
81 }