X-Git-Url: http://git.phpeclipse.com diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/InclusionStatement.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/InclusionStatement.java index 3a403a2..37d99c1 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/InclusionStatement.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/InclusionStatement.java @@ -1,14 +1,17 @@ package net.sourceforge.phpdt.internal.compiler.ast; +import java.util.List; + import net.sourceforge.phpdt.internal.compiler.parser.Outlineable; import net.sourceforge.phpdt.internal.ui.PHPUiImages; + import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.jface.text.Position; /** * @author Matthieu Casanova */ -public class InclusionStatement extends Statement implements Outlineable { +public final class InclusionStatement extends Statement implements Outlineable { public static final int INCLUDE = 0; public static final int INCLUDE_ONCE = 1; @@ -16,24 +19,26 @@ public class InclusionStatement extends Statement implements Outlineable { public static final int REQUIRE_ONCE = 3; public boolean silent; /** The kind of include. */ - public int keyword; - public Expression expression; + private final int keyword; + private final Expression expression; - private Object parent; + private final Object parent; - private Position position; - public InclusionStatement(Object parent, - int keyword, - Expression expression, - int sourceStart) { - super(sourceStart, expression.sourceEnd); + private final Position position; + + public InclusionStatement(final Object parent, + final int keyword, + final Expression expression, + final int sourceStart, + final int sourceEnd) { + super(sourceStart, sourceEnd); this.keyword = keyword; this.expression = expression; this.parent = parent; position = new Position(sourceStart, sourceEnd); } - public String keywordToString() { + private String keywordToString() { switch (keyword) { case INCLUDE: return "include"; //$NON-NLS-1$ @@ -52,20 +57,23 @@ public class InclusionStatement extends Statement implements Outlineable { * @param tab how many tabs (not used here * @return a String */ - public String toString(int tab) { + public String toString(final int tab) { final StringBuffer buffer = new StringBuffer(tabString(tab)); buffer.append(toString()); return buffer.toString(); } public String toString() { - final StringBuffer buffer = new StringBuffer(); + final String keyword = keywordToString(); + final String expressionString = expression.toStringExpression(); + final StringBuffer buffer = new StringBuffer(keyword.length() + + expressionString.length() + 2); if (silent) { buffer.append('@'); } - buffer.append(keywordToString()); - buffer.append(" "); - buffer.append(expression.toStringExpression()); + buffer.append(keyword); + buffer.append(' '); + buffer.append(expressionString); return buffer.toString(); } @@ -84,4 +92,31 @@ public class InclusionStatement extends Statement implements Outlineable { public Position getPosition() { return position; } + + /** + * Get the variables from outside (parameters, globals ...) + * + * @param list the list where we will put variables + */ + public void getOutsideVariable(final List list) { + expression.getOutsideVariable(list); + } + + /** + * get the modified variables. + * + * @param list the list where we will put variables + */ + public void getModifiedVariable(final List list) { + expression.getModifiedVariable(list); + } + + /** + * Get the variables used. + * + * @param list the list where we will put variables + */ + public void getUsedVariable(final List list) { + expression.getUsedVariable(list); + } }