X-Git-Url: http://secure.phpeclipse.com diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/MethodDeclaration.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/MethodDeclaration.java index d0ac842..5c3a64e 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/MethodDeclaration.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/MethodDeclaration.java @@ -4,10 +4,12 @@ import net.sourceforge.phpdt.internal.compiler.parser.OutlineableWithChildren; 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; import java.util.Hashtable; import java.util.Enumeration; import java.util.ArrayList; +import java.util.List; /** * A Method declaration. @@ -34,6 +36,8 @@ public class MethodDeclaration extends Statement implements OutlineableWithChild /** Tell if the method returns a reference. */ public boolean reference; + private Position position; + public MethodDeclaration(Object parent, char[] name, Hashtable arguments, @@ -45,6 +49,7 @@ public class MethodDeclaration extends Statement implements OutlineableWithChild this.arguments = arguments; this.parent = parent; this.reference = reference; + position = new Position(sourceStart, sourceEnd); } /** @@ -60,27 +65,7 @@ public class MethodDeclaration extends Statement implements OutlineableWithChild } public String toStringHeader() { - StringBuffer buff = new StringBuffer(); - buff.append("function ");//$NON-NLS-1$ - if (reference) { - buff.append('&');//$NON-NLS-1$ - } - buff.append(name).append("(");//$NON-NLS-1$ - - if (arguments != null) { - Enumeration values = arguments.elements(); - int i = 0; - while (values.hasMoreElements()) { - VariableDeclaration o = (VariableDeclaration) values.nextElement(); - buff.append(o.toStringExpression()); - if (i != (arguments.size() - 1)) { - buff.append(", "); //$NON-NLS-1$ - } - i++; - } - } - buff.append(")"); //$NON-NLS-1$ - return buff.toString(); + return "function " + toString(); } /** @@ -131,6 +116,33 @@ public class MethodDeclaration extends Statement implements OutlineableWithChild } public String toString() { - return toStringHeader(); + StringBuffer buff = new StringBuffer(); + if (reference) { + buff.append("&");//$NON-NLS-1$ + } + buff.append(name).append("(");//$NON-NLS-1$ + + if (arguments != null) { + Enumeration values = arguments.elements(); + int i = 0; + while (values.hasMoreElements()) { + VariableDeclaration o = (VariableDeclaration) values.nextElement(); + buff.append(o.toStringExpression()); + if (i != (arguments.size() - 1)) { + buff.append(", "); //$NON-NLS-1$ + } + i++; + } + } + buff.append(")"); //$NON-NLS-1$ + return buff.toString(); + } + + public Position getPosition() { + return position; + } + + public List getList() { + return children; } }