From: kpouer Date: Tue, 6 May 2003 22:22:45 +0000 (+0000) Subject: Some bugfix X-Git-Url: http://secure.phpeclipse.com Some bugfix --- diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ArgumentDeclaration.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ArgumentDeclaration.java index cffc971..b6c6a7c 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ArgumentDeclaration.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ArgumentDeclaration.java @@ -11,19 +11,32 @@ public class ArgumentDeclaration extends VariableDeclaration { /** * Create an argument. - * @param initialization the initialization * @param name the name + * @param reference the variable is a reference ? + * @param initialization the initialization * @param sourceStart the start point */ public ArgumentDeclaration(char[] name, + boolean reference, Expression initialization, - int sourceStart, - boolean reference) { + int sourceStart) { super(name, initialization, sourceStart); this.reference = reference; } /** + * Create an argument. + * @param name the name + * @param reference the variable is a reference ? + * @param sourceStart the start point + */ + public ArgumentDeclaration(char[] name, + boolean reference, + int sourceStart) { + super(name, sourceStart); + this.reference = reference; + } + /** * Return the expression as String. * @return the expression */ diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/EchoStatement.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/EchoStatement.java index eb18606..440556f 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/EchoStatement.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/EchoStatement.java @@ -9,7 +9,7 @@ public class EchoStatement extends Statement { public Expression[] expressions; public EchoStatement (Expression[] expressions, int sourceStart) { - super(sourceStart, expressions[expressions.length].sourceEnd); + super(sourceStart, expressions[expressions.length-1].sourceEnd); this.expressions = expressions; } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/FieldDeclaration.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/FieldDeclaration.java index dae26ff..90218e1 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/FieldDeclaration.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/FieldDeclaration.java @@ -1,22 +1,34 @@ package net.sourceforge.phpdt.internal.compiler.ast; -import net.sourceforge.phpdt.internal.compiler.parser.Outlineable; -import net.sourceforge.phpdt.internal.ui.PHPUiImages; -import org.eclipse.jface.resource.ImageDescriptor; - /** + * A Field declaration. + * This is a variable declaration for a php class + * In fact it's an array of VariableDeclaration, since a field could contains + * several vars : + * var $toto,$tata; * @author Matthieu Casanova */ public class FieldDeclaration extends Statement { + /** The variables. */ public VariableDeclaration[] vars; - public FieldDeclaration(VariableDeclaration[] vars,int sourceStart,int sourceEnd) { - super(sourceStart,sourceEnd); + /** + * Create a new field. + * @param vars the array of variables. + * @param sourceStart the starting offset + * @param sourceEnd the ending offset + */ + public FieldDeclaration(VariableDeclaration[] vars, int sourceStart, int sourceEnd) { + super(sourceStart, sourceEnd); this.vars = vars; } - + /** + * Return the object into String. + * @param tab how many tabs (not used here + * @return a String + */ public String toString(int tab) { final StringBuffer buff = new StringBuffer(tabString(tab)); buff.append("var "); diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/IfStatement.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/IfStatement.java index aa61a55..e1682c9 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/IfStatement.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/IfStatement.java @@ -6,16 +6,28 @@ package net.sourceforge.phpdt.internal.compiler.ast; public class IfStatement extends Statement { public Expression condition; + public Statement statement; public ElseIf[] elseifs; public Else els; + /** + * Create a new If statement + * @param condition the condition + * @param statement a statement or a block of statements + * @param elseifs the elseifs + * @param els the else (or null) + * @param sourceStart the starting position + * @param sourceEnd the ending offset + */ public IfStatement(Expression condition, + Statement statement, ElseIf[] elseifs, Else els, int sourceStart, int sourceEnd) { super(sourceStart, sourceEnd); this.condition = condition; + this.statement = statement; this.elseifs = elseifs; this.els = els; } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ListExpression.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ListExpression.java index 5ac7c04..9b6ef8f 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ListExpression.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ListExpression.java @@ -8,12 +8,22 @@ public class ListExpression extends Expression { public String[] vars; public Expression expression; - public ListExpression(String[] vars, Expression expression, int sourceStart, int sourceEnd) { + public ListExpression(String[] vars, + Expression expression, + int sourceStart, + int sourceEnd) { super(sourceStart, sourceEnd); this.vars = vars; this.expression = expression; } + public ListExpression(String[] vars, + int sourceStart, + int sourceEnd) { + super(sourceStart, sourceEnd); + this.vars = vars; + } + /** * Return the expression as String. * @return the expression diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/PHPDocument.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/PHPDocument.java index c01d085..e3bc4c5 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/PHPDocument.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/PHPDocument.java @@ -46,7 +46,7 @@ public class PHPDocument implements OutlineableWithChildren { if (node == null) { break; } - buff.append(node); + buff.append(node.toString(0)); } return buff.toString(); } diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/VariableDeclaration.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/VariableDeclaration.java index 25ae677..eef7d94 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/VariableDeclaration.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/VariableDeclaration.java @@ -64,6 +64,18 @@ public class VariableDeclaration extends AbstractVariableDeclaration implements super(name, sourceStart, initialization.sourceEnd); this.initialization = initialization; } + + /** + * Create a variable. + * @param name the name of the variable + * @param sourceStart the start point + */ + public VariableDeclaration(char[] name, + int sourceStart) { + super(name, sourceStart, sourceStart + name.length); + this.initialization = initialization; + } + /** * Return the variable into String. * @return a String