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.ast;
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;
21 public abstract class Statement extends ASTNode {
24 * Statement constructor comment.
30 public abstract FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo);
32 // public abstract void generateCode(BlockScope currentScope, CodeStream codeStream);
34 public boolean isEmptyBlock() {
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.....-)
52 public StringBuffer print(int indent, StringBuffer output) {
53 return printStatement(indent, output);
55 public abstract StringBuffer printStatement(int indent, StringBuffer output);
57 public abstract void resolve(BlockScope scope);
59 public Constant resolveCase(BlockScope scope, TypeBinding testType, SwitchStatement switchStatement) {
60 // statement within a switch that are not case are treated as normal statement....
66 public void resetStateForCodeGeneration() {
71 * Do nothing by default. This is used to redirect inter-statements jumps.
73 public void branchChainTo(Label label) {