1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-07 09:46:02 +02:00

Code formatting.

This commit is contained in:
Sergey Prigogin 2008-11-09 05:01:57 +00:00
parent 4f541baeb7
commit fc22e5fdce
10 changed files with 94 additions and 119 deletions

View file

@ -33,14 +33,12 @@ import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
* @author jcamelon
*/
public class CASTDeclarator extends ASTNode implements IASTDeclarator, IASTAmbiguityParent {
private IASTInitializer initializer;
private IASTName name;
private IASTDeclarator nestedDeclarator;
private IASTPointerOperator[] pointerOps = null;
private int pointerOpsPos= -1;
public CASTDeclarator() {
}
@ -71,7 +69,6 @@ public class CASTDeclarator extends ASTNode implements IASTDeclarator, IASTAmbig
return initializer;
}
public void setInitializer(IASTInitializer initializer) {
this.initializer = initializer;
if (initializer != null) {
@ -114,26 +111,27 @@ public class CASTDeclarator extends ASTNode implements IASTDeclarator, IASTAmbig
}
}
if( getPropertyInParent() != IASTTypeId.ABSTRACT_DECLARATOR &&
nestedDeclarator == null )
{
if( getParent() instanceof IASTDeclarator )
{
if (getPropertyInParent() != IASTTypeId.ABSTRACT_DECLARATOR && nestedDeclarator == null) {
if (getParent() instanceof IASTDeclarator) {
IASTDeclarator outermostDeclarator = (IASTDeclarator) getParent();
while (outermostDeclarator.getParent() instanceof IASTDeclarator)
outermostDeclarator = (IASTDeclarator) outermostDeclarator.getParent();
if( outermostDeclarator.getPropertyInParent() != IASTTypeId.ABSTRACT_DECLARATOR )
if( name != null ) if( !name.accept( action ) ) return false;
if (outermostDeclarator.getPropertyInParent() != IASTTypeId.ABSTRACT_DECLARATOR &&
name != null && !name.accept(action)) {
return false;
}
else
if( name != null ) if( !name.accept( action ) ) return false;
} else if (name != null && !name.accept(action)) {
return false;
}
}
if (nestedDeclarator != null && !nestedDeclarator.accept(action)) {
return false;
}
if( nestedDeclarator != null ) if( !nestedDeclarator.accept( action ) ) return false;
IASTPointerOperator[] ptrOps = getPointerOperators();
for (int i = 0; i < ptrOps.length; i++) {
if( !ptrOps[i].accept( action ) ) return false;
if (!ptrOps[i].accept(action))
return false;
}
if (!postAccept(action))
@ -153,24 +151,19 @@ public class CASTDeclarator extends ASTNode implements IASTDeclarator, IASTAmbig
}
public int getRoleForName(IASTName n) {
if( n == this.name )
{
if (n == this.name) {
IASTNode getParent = getParent();
boolean fnDtor = (this instanceof IASTFunctionDeclarator);
if( getParent instanceof IASTDeclaration )
{
if (getParent instanceof IASTDeclaration) {
if (getParent instanceof IASTFunctionDefinition)
return r_definition;
if( getParent instanceof IASTSimpleDeclaration )
{
if (getParent instanceof IASTSimpleDeclaration) {
IASTSimpleDeclaration sd = (IASTSimpleDeclaration) getParent;
int storage = sd.getDeclSpecifier().getStorageClass();
if (getInitializer() != null || storage == IASTDeclSpecifier.sc_typedef)
return r_definition;
if( storage == IASTDeclSpecifier.sc_extern ||
storage == IASTDeclSpecifier.sc_static )
{
if (storage == IASTDeclSpecifier.sc_extern || storage == IASTDeclSpecifier.sc_static) {
return r_declaration;
}
@ -179,25 +172,22 @@ public class CASTDeclarator extends ASTNode implements IASTDeclarator, IASTAmbig
}
if (getParent instanceof IASTTypeId)
return r_reference;
if( getParent instanceof IASTDeclarator )
{
if (getParent instanceof IASTDeclarator) {
IASTNode t = getParent;
while (t instanceof IASTDeclarator)
t = t.getParent();
if( t instanceof IASTDeclaration )
{
if (t instanceof IASTDeclaration) {
if (getParent instanceof IASTFunctionDefinition)
return r_definition;
if( getParent instanceof IASTSimpleDeclaration )
{
if (getParent instanceof IASTSimpleDeclaration) {
if (getInitializer() != null)
return r_definition;
IASTSimpleDeclaration sd = (IASTSimpleDeclaration) getParent;
int storage = sd.getDeclSpecifier().getStorageClass();
if( storage == IASTDeclSpecifier.sc_extern ||
storage == IASTDeclSpecifier.sc_static)
if (storage == IASTDeclSpecifier.sc_extern || storage == IASTDeclSpecifier.sc_static) {
return r_declaration;
}
}
return fnDtor ? r_declaration : r_definition;
}
if (t instanceof IASTTypeId)

View file

@ -38,7 +38,6 @@ public class CPPASTDeclarator extends ASTNode implements IASTDeclarator {
private IASTPointerOperator[] pointerOps = null;
private int pointerOpsPos= -1;
public CPPASTDeclarator() {
}
@ -93,7 +92,6 @@ public class CPPASTDeclarator extends ASTNode implements IASTDeclarator {
}
}
public void setName(IASTName name) {
this.name = name;
if (name != null) {
@ -148,8 +146,7 @@ public class CPPASTDeclarator extends ASTNode implements IASTDeclarator {
public int getRoleForName(IASTName n) {
IASTNode getParent = getParent();
boolean fnDtor = (this instanceof IASTFunctionDeclarator);
if( getParent instanceof IASTDeclaration )
{
if (getParent instanceof IASTDeclaration) {
if (getParent instanceof IASTFunctionDefinition)
return r_definition;
if (getParent instanceof IASTSimpleDeclaration) {
@ -157,9 +154,7 @@ public class CPPASTDeclarator extends ASTNode implements IASTDeclarator {
if (getInitializer() != null || storage == IASTDeclSpecifier.sc_typedef)
return r_definition;
if( storage == IASTDeclSpecifier.sc_extern ||
storage == IASTDeclSpecifier.sc_static )
{
if (storage == IASTDeclSpecifier.sc_extern || storage == IASTDeclSpecifier.sc_static) {
return r_declaration;
}
}
@ -167,25 +162,20 @@ public class CPPASTDeclarator extends ASTNode implements IASTDeclarator {
}
if (getParent instanceof IASTTypeId)
return r_reference;
if( getParent instanceof IASTDeclarator )
{
if (getParent instanceof IASTDeclarator) {
IASTNode t = getParent;
while (t instanceof IASTDeclarator)
t = t.getParent();
if( t instanceof IASTDeclaration )
{
if (t instanceof IASTDeclaration) {
if (getParent instanceof IASTFunctionDefinition)
return r_definition;
if( getParent instanceof IASTSimpleDeclaration )
{
if (getParent instanceof IASTSimpleDeclaration) {
if (getInitializer() != null)
return r_definition;
IASTSimpleDeclaration sd = (IASTSimpleDeclaration) getParent;
int storage = sd.getDeclSpecifier().getStorageClass();
if( storage == IASTDeclSpecifier.sc_extern ||
storage == IASTDeclSpecifier.sc_typedef ||
storage == IASTDeclSpecifier.sc_static )
{
if (storage == IASTDeclSpecifier.sc_extern || storage == IASTDeclSpecifier.sc_typedef ||
storage == IASTDeclSpecifier.sc_static) {
return r_declaration;
}
}

View file

@ -211,7 +211,7 @@ public abstract class CPPTemplateParameter extends PlatformObject
return null;
IASTNode node= declarations[0];
while (node instanceof ICPPASTTemplateParameter == false) {
while (!(node instanceof ICPPASTTemplateParameter)) {
if (node == null)
return null;

View file

@ -66,8 +66,7 @@ class PDOMCPPClassType extends PDOMCPPBinding implements IPDOMCPPClassType, IPDO
private ICPPClassScope fScope;
public PDOMCPPClassType(PDOM pdom, PDOMNode parent, ICPPClassType classType)
throws CoreException {
public PDOMCPPClassType(PDOM pdom, PDOMNode parent, ICPPClassType classType) throws CoreException {
super(pdom, parent, classType.getNameCharArray());
setKind(classType);
@ -89,7 +88,6 @@ class PDOMCPPClassType extends PDOMCPPBinding implements IPDOMCPPClassType, IPDO
return IIndexCPPBindingConstants.CPPCLASSTYPE;
}
@Override
public void update(PDOMLinkage linkage, IBinding newBinding) throws CoreException {
if (newBinding instanceof ICPPClassType) {
@ -142,7 +140,6 @@ class PDOMCPPClassType extends PDOMCPPBinding implements IPDOMCPPClassType, IPDO
list.accept(visitor);
}
private PDOMCPPBase getFirstBase() throws CoreException {
int rec = pdom.getDB().getInt(record + FIRSTBASE);
return rec != 0 ? new PDOMCPPBase(pdom, rec) : null;

View file

@ -49,7 +49,6 @@ import org.eclipse.cdt.internal.core.browser.ASTTypeInfo;
*
*/
public abstract class PDOMSearchQuery implements ISearchQuery {
public static final int FIND_DECLARATIONS = 0x1;
public static final int FIND_DEFINITIONS = 0x2;
public static final int FIND_REFERENCES = 0x4;
@ -155,10 +154,9 @@ public abstract class PDOMSearchQuery implements ISearchQuery {
names.addAll(Arrays.asList(ast.getReferences(binding)));
for (IASTName name : names) {
if ( ((flags & FIND_DECLARATIONS) != 0 && name.isDeclaration())
|| ((flags & FIND_DEFINITIONS) != 0 && name.isDefinition())
|| ((flags & FIND_REFERENCES) != 0 && name.isReference())) {
if (((flags & FIND_DECLARATIONS) != 0 && name.isDeclaration()) ||
((flags & FIND_DEFINITIONS) != 0 && name.isDefinition()) ||
((flags & FIND_REFERENCES) != 0 && name.isReference())) {
ASTTypeInfo typeInfo= ASTTypeInfo.create(name);
if (typeInfo != null) {
ITypeReference ref= typeInfo.getResolvedReference();