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

Added toString method.

This commit is contained in:
Sergey Prigogin 2008-02-11 00:40:49 +00:00
parent 8111176e94
commit 9d578b5f13

View file

@ -46,6 +46,7 @@ public class CPPTypedef extends PlatformObject implements ITypedef, ITypeContain
((ITypeContainer)getBinding()).setType(type);
}
}
private IASTName[] declarations = null;
private IType type = null;
@ -75,7 +76,7 @@ public class CPPTypedef extends PlatformObject implements ITypedef, ITypeContain
public boolean isSameType(IType o) {
if (o == this)
return true;
if( o instanceof ITypedef )
if (o instanceof ITypedef) {
try {
IType t = getType();
if (t != null)
@ -84,6 +85,7 @@ public class CPPTypedef extends PlatformObject implements ITypedef, ITypeContain
} catch (DOMException e) {
return false;
}
}
IType t = getType();
if (t != null)
@ -184,11 +186,12 @@ public class CPPTypedef extends PlatformObject implements ITypedef, ITypeContain
return;
IASTName name = (IASTName) node;
if( declarations == null )
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() ){
if (declarations.length > 0 &&
((ASTNode )node).getOffset() < ((ASTNode) declarations[0]).getOffset()) {
declarations = (IASTName[]) ArrayUtil.prepend(IASTName.class, declarations, name);
} else {
declarations = (IASTName[]) ArrayUtil.append(IASTName.class, declarations, name);
@ -203,4 +206,8 @@ public class CPPTypedef extends PlatformObject implements ITypedef, ITypeContain
public ILinkage getLinkage() {
return Linkage.CPP_LINKAGE;
}
public String toString() {
return getName();
}
}