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-04-17 01:25:52 +00:00
parent be2cedef32
commit 048e36a160

View file

@ -26,13 +26,12 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
/** /**
* Definition of a namespace. * Definition of a namespace.
*/ */
public class CPPASTNamespaceDefinition extends ASTNode implements public class CPPASTNamespaceDefinition extends ASTNode
ICPPASTNamespaceDefinition, IASTAmbiguityParent { implements ICPPASTNamespaceDefinition, IASTAmbiguityParent {
private IASTName fName; private IASTName fName;
private IASTDeclaration[] fAllDeclarations; private IASTDeclaration[] fAllDeclarations;
private IASTDeclaration[] fActiveDeclarations; private IASTDeclaration[] fActiveDeclarations;
private int fLastDeclaration=-1; private int fLastDeclaration= -1;
private boolean fIsInline; private boolean fIsInline;
public CPPASTNamespaceDefinition() { public CPPASTNamespaceDefinition() {
@ -47,11 +46,12 @@ public class CPPASTNamespaceDefinition extends ASTNode implements
} }
public CPPASTNamespaceDefinition copy(CopyStyle style) { public CPPASTNamespaceDefinition copy(CopyStyle style) {
CPPASTNamespaceDefinition copy = new CPPASTNamespaceDefinition(fName == null ? null CPPASTNamespaceDefinition copy =
: fName.copy(style)); new CPPASTNamespaceDefinition(fName == null ? null : fName.copy(style));
copy.fIsInline = fIsInline; copy.fIsInline = fIsInline;
for (IASTDeclaration declaration : getDeclarations()) for (IASTDeclaration declaration : getDeclarations()) {
copy.addDeclaration(declaration == null ? null : declaration.copy(style)); copy.addDeclaration(declaration == null ? null : declaration.copy(style));
}
copy.setOffsetAndLength(this); copy.setOffsetAndLength(this);
if (style == CopyStyle.withLocations) { if (style == CopyStyle.withLocations) {
copy.setCopyLocation(this); copy.setCopyLocation(this);
@ -85,7 +85,7 @@ public class CPPASTNamespaceDefinition extends ASTNode implements
if (decl != null) { if (decl != null) {
decl.setParent(this); decl.setParent(this);
decl.setPropertyInParent(OWNED_DECLARATION); decl.setPropertyInParent(OWNED_DECLARATION);
fAllDeclarations = (IASTDeclaration[]) ArrayUtil.append( IASTDeclaration.class, fAllDeclarations, ++fLastDeclaration, decl); fAllDeclarations = (IASTDeclaration[]) ArrayUtil.append(IASTDeclaration.class, fAllDeclarations, ++fLastDeclaration, decl);
fActiveDeclarations= null; fActiveDeclarations= null;
} }
} }
@ -115,9 +115,9 @@ public class CPPASTNamespaceDefinition extends ASTNode implements
public boolean accept(ASTVisitor action) { public boolean accept(ASTVisitor action) {
if (action.shouldVisitNamespaces) { if (action.shouldVisitNamespaces) {
switch (action.visit(this)) { switch (action.visit(this)) {
case ASTVisitor.PROCESS_ABORT : return false; case ASTVisitor.PROCESS_ABORT: return false;
case ASTVisitor.PROCESS_SKIP : return true; case ASTVisitor.PROCESS_SKIP: return true;
default : break; default: break;
} }
} }
@ -126,7 +126,8 @@ public class CPPASTNamespaceDefinition extends ASTNode implements
IASTDeclaration [] decls = getDeclarations(action.includeInactiveNodes); IASTDeclaration [] decls = getDeclarations(action.includeInactiveNodes);
for (IASTDeclaration decl : decls) { for (IASTDeclaration decl : decls) {
if (!decl.accept(action)) return false; if (!decl.accept(action))
return false;
} }
if (action.shouldVisitNamespaces && action.leave(this) == ASTVisitor.PROCESS_ABORT) if (action.shouldVisitNamespaces && action.leave(this) == ASTVisitor.PROCESS_ABORT)
@ -136,7 +137,8 @@ public class CPPASTNamespaceDefinition extends ASTNode implements
} }
public int getRoleForName(IASTName n) { public int getRoleForName(IASTName n) {
if( fName == n ) return r_definition; if (fName == n)
return r_definition;
return r_unclear; return r_unclear;
} }