1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Cosmetics.

This commit is contained in:
Sergey Prigogin 2011-08-28 20:52:37 -07:00
parent 17f96f9eb3
commit d88c1111f7

View file

@ -25,7 +25,9 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
* Models a simple declaration. * Models a simple declaration.
*/ */
public class CASTSimpleDeclaration extends ASTNode implements IASTSimpleDeclaration, IASTAmbiguityParent { public class CASTSimpleDeclaration extends ASTNode implements IASTSimpleDeclaration, IASTAmbiguityParent {
private IASTDeclarator[] declarators;
private int declaratorsPos = -1;
private IASTDeclSpecifier declSpecifier;
public CASTSimpleDeclaration() { public CASTSimpleDeclaration() {
} }
@ -57,7 +59,8 @@ public class CASTSimpleDeclaration extends ASTNode implements IASTSimpleDeclarat
} }
public IASTDeclarator[] getDeclarators() { public IASTDeclarator[] getDeclarators() {
if( declarators == null ) return IASTDeclarator.EMPTY_DECLARATOR_ARRAY; if (declarators == null)
return IASTDeclarator.EMPTY_DECLARATOR_ARRAY;
declarators = (IASTDeclarator[]) ArrayUtil.removeNullsAfter(IASTDeclarator.class, declarators, declaratorsPos); declarators = (IASTDeclarator[]) ArrayUtil.removeNullsAfter(IASTDeclarator.class, declarators, declaratorsPos);
return declarators; return declarators;
} }
@ -71,12 +74,6 @@ public class CASTSimpleDeclaration extends ASTNode implements IASTSimpleDeclarat
} }
} }
private IASTDeclarator [] declarators = null;
private int declaratorsPos=-1;
private IASTDeclSpecifier declSpecifier;
public void setDeclSpecifier(IASTDeclSpecifier declSpecifier) { public void setDeclSpecifier(IASTDeclSpecifier declSpecifier) {
assertNotFrozen(); assertNotFrozen();
this.declSpecifier = declSpecifier; this.declSpecifier = declSpecifier;
@ -96,10 +93,13 @@ public class CASTSimpleDeclaration extends ASTNode implements IASTSimpleDeclarat
} }
} }
if( declSpecifier != null ) if( !declSpecifier.accept( action ) ) return false; if (declSpecifier != null && !declSpecifier.accept(action))
return false;
IASTDeclarator[] dtors = getDeclarators(); IASTDeclarator[] dtors = getDeclarators();
for( int i = 0; i < dtors.length; i++ ) for (int i = 0; i < dtors.length; i++) {
if( !dtors[i].accept( action ) ) return false; if (!dtors[i].accept(action))
return false;
}
if (action.shouldVisitDeclarations) { if (action.shouldVisitDeclarations) {
switch (action.leave(this)) { switch (action.leave(this)) {