13822d7cf7827c4dcb2668014771c629dbc77e58
[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 import java.util.ArrayList;
5
6 /**
7  * A return statement.
8  * @author Matthieu Casanova
9  */
10 public class ReturnStatement extends Statement {
11
12   public Expression expression;
13
14   public ReturnStatement(final Expression expression, final int sourceStart, final int sourceEnd) {
15     super(sourceStart, sourceEnd);
16     this.expression = expression;
17   }
18
19   public String toString(final int tab) {
20     final String s = tabString(tab);
21     if (expression == null) {
22       return s + "return";//$NON-NLS-1$
23     }
24     return s + "return " + expression.toStringExpression();//$NON-NLS-1$
25   }
26
27     /**
28    * Get the variables from outside (parameters, globals ...)
29    * @return the variables from outside
30    */
31   public List getOutsideVariable() {
32     return new ArrayList();
33   }
34
35   /**
36    * get the modified variables.
37    * @return the variables modified
38    */
39   public List getModifiedVariable() {
40     if (expression == null) {
41         return new ArrayList();
42     }
43     return expression.getModifiedVariable();
44   }
45
46   /**
47    * Get the variables used.
48    * @return the variables used
49    */
50   public List getUsedVariable() {
51     if (expression == null) {
52         return new ArrayList();
53     }
54     return expression.getUsedVariable();
55   }
56 }