Some minor changes
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / compiler / ast / ReturnStatement.java
1 package net.sourceforge.phpdt.internal.compiler.ast;
2
3 import java.util.List;
4
5 /**
6  * A return statement.
7  * @author Matthieu Casanova
8  */
9 public final class ReturnStatement extends Statement {
10
11   private final Expression expression;
12
13   public ReturnStatement(final Expression expression, final int sourceStart, final int sourceEnd) {
14     super(sourceStart, sourceEnd);
15     this.expression = expression;
16   }
17
18   public String toString(final int tab) {
19     final String s = tabString(tab);
20     if (expression == null) {
21       return s + "return";//$NON-NLS-1$
22     }
23     return s + "return " + expression.toStringExpression();//$NON-NLS-1$
24   }
25
26   /**
27    * Get the variables from outside (parameters, globals ...)
28    *
29    * @param list the list where we will put variables
30    */
31   public void getOutsideVariable(final List list) {}
32
33   /**
34    * get the modified variables.
35    *
36    * @param list the list where we will put variables
37    */
38   public void getModifiedVariable(final List list) {
39     if (expression != null) {
40       expression.getModifiedVariable(list);
41     }
42   }
43
44   /**
45    * Get the variables used.
46    *
47    * @param list the list where we will put variables
48    */
49   public void getUsedVariable(final List list) {
50     if (expression != null) {
51         expression.getUsedVariable(list);
52     }
53   }
54 }