Fix bug #1385272: Improved version for "Parsing of short open tags not fully compatib...
[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
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         public StringBuffer print(int indent, StringBuffer output) {
53                 return printStatement(indent, output);
54         }
55         public abstract StringBuffer printStatement(int indent, StringBuffer output);
56
57         public abstract void resolve(BlockScope scope);
58         
59         public Constant resolveCase(BlockScope scope, TypeBinding testType, SwitchStatement switchStatement) {
60                 // statement within a switch that are not case are treated as normal statement.... 
61
62                 resolve(scope);
63                 return null;
64         }
65         
66         public void resetStateForCodeGeneration() {
67         }
68         
69         /**
70          * INTERNAL USE ONLY.
71          * Do nothing by default. This is used to redirect inter-statements jumps.
72          */
73         public void branchChainTo(Label label) {
74         }
75 }