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

toString method.

This commit is contained in:
Sergey Prigogin 2009-08-02 05:27:10 +00:00
parent e22010288b
commit 4554f2baf8

View file

@ -34,7 +34,6 @@ public class CPPASTIdExpression extends ASTNode implements IASTIdExpression, IAS
private IASTName name; private IASTName name;
public CPPASTIdExpression() { public CPPASTIdExpression() {
} }
@ -47,7 +46,7 @@ public class CPPASTIdExpression extends ASTNode implements IASTIdExpression, IAS
copy.setOffsetAndLength(this); copy.setOffsetAndLength(this);
return copy; return copy;
} }
public IASTName getName() { public IASTName getName() {
return name; return name;
} }
@ -62,21 +61,21 @@ public class CPPASTIdExpression extends ASTNode implements IASTIdExpression, IAS
} }
@Override @Override
public boolean accept( ASTVisitor action ){ public boolean accept(ASTVisitor action) {
if( action.shouldVisitExpressions ){ if (action.shouldVisitExpressions) {
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;
} }
} }
if( name != null ) if( !name.accept( action ) ) return false;
if( action.shouldVisitExpressions ){ if (name != null && !name.accept(action)) return false;
switch( action.leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false; if (action.shouldVisitExpressions) {
case ASTVisitor.PROCESS_SKIP : return true; switch (action.leave(this)) {
case ASTVisitor.PROCESS_ABORT: return false;
case ASTVisitor.PROCESS_SKIP: return true;
default : break; default : break;
} }
} }
@ -84,10 +83,10 @@ public class CPPASTIdExpression extends ASTNode implements IASTIdExpression, IAS
} }
public int getRoleForName(IASTName n) { public int getRoleForName(IASTName n) {
if( name == n )return r_reference; if (name == n) return r_reference;
return r_unclear; return r_unclear;
} }
public IType getExpressionType() { public IType getExpressionType() {
IBinding binding = name.resolvePreBinding(); IBinding binding = name.resolvePreBinding();
try { try {
@ -111,8 +110,13 @@ public class CPPASTIdExpression extends ASTNode implements IASTIdExpression, IAS
} }
return null; return null;
} }
public IBinding[] findBindings(IASTName n, boolean isPrefix) { public IBinding[] findBindings(IASTName n, boolean isPrefix) {
return CPPSemantics.findBindingsForContentAssist(n, isPrefix); return CPPSemantics.findBindingsForContentAssist(n, isPrefix);
} }
@Override
public String toString() {
return name != null ? name.toString() : "<unnamed>"; //$NON-NLS-1$
}
} }