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

toString method.

This commit is contained in:
Sergey Prigogin 2008-08-25 00:08:17 +00:00
parent 9acb20d524
commit bc2382f2ca

View file

@ -75,6 +75,7 @@ public class CPPVariable extends PlatformObject implements ICPPVariable, ICPPInt
throw new DOMException(this);
}
}
private IASTName declarations[] = null;
private IASTName definition = null;
private IType type = null;
@ -108,8 +109,7 @@ public class CPPVariable extends PlatformObject implements ICPPVariable, ICPPInt
return false;
//or it declares a static data member in a class declaration
if (simpleDecl.getParent() instanceof ICPPASTCompositeTypeSpecifier &&
declSpec.getStorageClass() == IASTDeclSpecifier.sc_static )
{
declSpec.getStorageClass() == IASTDeclSpecifier.sc_static) {
return false;
}
@ -135,11 +135,11 @@ public class CPPVariable extends PlatformObject implements ICPPVariable, ICPPInt
if (!(node instanceof IASTName))
return;
IASTName name = (IASTName) node;
if( isDefinition( name ) )
if (isDefinition(name)) {
definition = name;
else if( declarations == null )
} else if (declarations == null) {
declarations = new IASTName[] { name };
else {
} else {
//keep the lowest offset declaration in[0]
if (declarations.length > 0 && ((ASTNode) node).getOffset() < ((ASTNode) declarations[0]).getOffset()) {
declarations = (IASTName[]) ArrayUtil.prepend(IASTName.class, declarations, name);
@ -300,7 +300,6 @@ public class CPPVariable extends PlatformObject implements ICPPVariable, ICPPInt
return false;
}
public boolean isStatic() {
return hasStorageClass(IASTDeclSpecifier.sc_static);
}
@ -352,4 +351,9 @@ public class CPPVariable extends PlatformObject implements ICPPVariable, ICPPInt
IASTName node = definition != null ? definition : declarations[0];
return CPPVisitor.findNameOwner(node, !hasStorageClass(IASTDeclSpecifier.sc_extern));
}
@Override
public String toString() {
return getName();
}
}