ASTType now has an isArray() method

git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@2220 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
Tom Copeland
2003-08-28 16:00:43 +00:00
parent 5d0ce11153
commit a4aa270477
4 changed files with 256 additions and 245 deletions

View File

@ -9,6 +9,7 @@ Tweaked CPD time display field
Made CPD text fields uneditable
Added more error checking to CPD GUI input
Added "dialog cancelled" check to CPD "Save" function
ASTType now has an isArray() method.
TODO - fix it so tests and rules don't duplicate the xpath expressions
August 1, 2003 - 1.2.1:

View File

@ -610,27 +610,20 @@ void Initializer() :
void Type() :
{}
{
( PrimitiveType() | Name() ) ( "[" "]" )*
( PrimitiveType() | Name() ) ( "[" "]" {jjtThis.setIsArray();} )*
}
void PrimitiveType() :
{}
{
"boolean" {jjtThis.setImage("boolean");}
|
"char" {jjtThis.setImage("char");}
|
"byte" {jjtThis.setImage("byte");}
|
"short" {jjtThis.setImage("short");}
|
"int" {jjtThis.setImage("int");}
|
"long" {jjtThis.setImage("long");}
|
"float" {jjtThis.setImage("float");}
|
"double" {jjtThis.setImage("double");}
| "char" {jjtThis.setImage("char");}
| "byte" {jjtThis.setImage("byte");}
| "short" {jjtThis.setImage("short");}
| "int" {jjtThis.setImage("int");}
| "long" {jjtThis.setImage("long");}
| "float" {jjtThis.setImage("float");}
| "double" {jjtThis.setImage("double");}
}
@ -638,8 +631,7 @@ void ResultType() :
{}
{
"void"
|
Type()
| Type()
}
void Name() :

View File

@ -11,9 +11,26 @@ public class ASTType extends SimpleNode {
super(p, id);
}
private boolean isArray;
public boolean isArray() {
return this.isArray;
}
public void setIsArray() {
this.isArray = true;
}
/** Accept the visitor. **/
public Object jjtAccept(JavaParserVisitor visitor, Object data) {
return visitor.visit(this, data);
}
public void dump(String prefix) {
String out = toString(prefix) + ":";
if (isArray()) {out += "(array)";}
System.out.println(out);
dumpChildren(prefix);
}
}

File diff suppressed because it is too large Load Diff