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;
20 public abstract class Statement extends ASTNode {
23 * Statement constructor comment.
29 public abstract FlowInfo analyseCode(BlockScope currentScope,
30 FlowContext flowContext, FlowInfo flowInfo);
32 // public abstract void generateCode(BlockScope currentScope, CodeStream
35 public boolean isEmptyBlock() {
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
50 // -this is an appromative idea.....-)
55 public StringBuffer print(int indent, StringBuffer output) {
56 return printStatement(indent, output);
59 public abstract StringBuffer printStatement(int indent, StringBuffer output);
61 public abstract void resolve(BlockScope scope);
63 public Constant resolveCase(BlockScope scope, TypeBinding testType,
64 SwitchStatement switchStatement) {
65 // statement within a switch that are not case are treated as normal
72 public void resetStateForCodeGeneration() {
76 * INTERNAL USE ONLY. Do nothing by default. This is used to redirect
77 * inter-statements jumps.
79 public void branchChainTo(Label label) {