1 /*******************************************************************************
 
   2  * Copyright (c) 2000, 2001, 2002 International Business Machines Corp. and others.
 
   3  * All rights reserved. This program and the accompanying materials 
 
   4  * are made available under the terms of the Common Public License v0.5 
 
   5  * which accompanies this distribution, and is available at
 
   6  * http://www.eclipse.org/legal/cpl-v05.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.CodeStream;
 
  14 import net.sourceforge.phpdt.internal.compiler.codegen.Label;
 
  15 import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
 
  16 import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
 
  17 import net.sourceforge.phpdt.internal.compiler.impl.Constant;
 
  18 import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
 
  19 import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
 
  20 import net.sourceforge.phpdt.internal.compiler.problem.ShouldNotImplement;
 
  21 import net.sourceforge.phpdt.internal.compiler.util.Util;
 
  23 public abstract class Statement extends AstNode {
 
  26          * Statement constructor comment.
 
  32         public FlowInfo analyseCode(
 
  33                 BlockScope currentScope,
 
  34                 FlowContext flowContext,
 
  39         public void generateCode(BlockScope currentScope, CodeStream codeStream) {
 
  40                 throw new ShouldNotImplement(Util.bind("ast.missingStatement")); //$NON-NLS-1$
 
  43         public boolean isEmptyBlock() {
 
  47         public boolean isValidJavaStatement() {
 
  48                 //the use of this method should be avoid in most cases
 
  49                 //and is here mostly for documentation purpose.....
 
  50                 //while the parser is responsable for creating
 
  51                 //welled formed expression statement, which results
 
  52                 //in the fact that java-non-semantic-expression-used-as-statement
 
  53                 //should not be parsable...thus not being built.
 
  54                 //It sounds like the java grammar as help the compiler job in removing
 
  55                 //-by construction- some statement that would have no effect....
 
  56                 //(for example all expression that may do side-effects are valid statement
 
  57                 // -this is an appromative idea.....-)
 
  62         public void resolve(BlockScope scope) {
 
  65         public Constant resolveCase(
 
  68                 SwitchStatement switchStatement) {
 
  69                 // statement within a switch that are not case are treated as normal statement.... 
 
  75         public void resetStateForCodeGeneration() {
 
  80          * Do nothing by default. This is used to redirect inter-statements jumps.
 
  82         public void branchChainTo(Label label) {