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 class ReturnStatement extends Statement {
10
11   public 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   public void getOutsideVariable(final List list) {
30   }
31
32   /**
33    * get the modified variables.
34    */
35   public void getModifiedVariable(final List list) {
36     if (expression != null) {
37       expression.getModifiedVariable(list);
38     }
39   }
40
41   /**
42    * Get the variables used.
43    */
44   public void getUsedVariable(final List list) {
45     if (expression != null) {
46         expression.getUsedVariable(list);
47     }
48   }
49 }