+++ /dev/null
-package net.sourceforge.phpdt.internal.compiler.ast;
-
-/**
- * A Method declaration.
- * @author Matthieu Casanova
- */
-public class MethodDeclaration extends Statement {
-
- public char[] name;
- public ArgumentDeclaration[] arguments;
- public Statement[] statements;
- public int bodyStart;
- public int bodyEnd = -1;
- public boolean isConstructor;
-
- /**
- * Return method into String, with a number of tabs
- * @param tab the number of tabs
- * @return the String containing the method
- */
- public String toString(int tab) {
- String s = tabString(tab);
- StringBuffer buff = new StringBuffer(s);
- buff.append(name).append("(");//$NON-NLS-1$
-
- if (arguments != null) {
- for (int i = 0; i < arguments.length; i++) {
- buff.append(arguments[i].toString(0));
- if (i != (arguments.length - 1)) {
- buff.append(", "); //$NON-NLS-1$
- }
- }
- }
- buff.append(")"); //$NON-NLS-1$
-
- s += toStringStatements(tab + 1);
- return s;
- }
-
- /**
- * Return the statements of the method into Strings
- * @param tab the number of tabs
- * @return the String containing the statements
- */
- public String toStringStatements(int tab) {
- StringBuffer buff = new StringBuffer(" {"); //$NON-NLS-1$
- if (statements != null) {
- for (int i = 0; i < statements.length; i++) {
- buff.append("\n").append(statements[i].toString(tab)); //$NON-NLS-1$
- if (!(statements[i] instanceof Block)) {
- buff.append(";"); //$NON-NLS-1$
- }
- }
- }
- buff.append("\n").append(tabString(tab == 0 ? 0 : tab - 1)).append("}"); //$NON-NLS-2$ //$NON-NLS-1$
- return buff.toString();
- }
-}