mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-05 08:46:02 +02:00
cleaned up CPPASTQualifiedName a bit
This commit is contained in:
parent
616efbbdbe
commit
4117aeccbd
2 changed files with 14 additions and 16 deletions
|
@ -48,7 +48,7 @@ public class CPPASTQualifiedName extends CPPASTNode implements
|
|||
// The full qualified name resolves to the same thing as the last name
|
||||
removeNullNames();
|
||||
IASTName lastName = getLastName();
|
||||
return lastName != null ? lastName.resolveBinding() : null;
|
||||
return lastName == null ? null : lastName.resolveBinding();
|
||||
}
|
||||
|
||||
public IASTCompletionContext getCompletionContext() {
|
||||
|
@ -63,10 +63,9 @@ public class CPPASTQualifiedName extends CPPASTNode implements
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
if (signature == null)
|
||||
return ""; //$NON-NLS-1$
|
||||
return signature;
|
||||
return (signature == null) ? "" : signature; //$NON-NLS-1$
|
||||
}
|
||||
|
||||
public void addName(IASTName name) {
|
||||
|
@ -83,7 +82,7 @@ public class CPPASTQualifiedName extends CPPASTNode implements
|
|||
|
||||
private IASTName[] names = null;
|
||||
private int namesPos=-1;
|
||||
private boolean value;
|
||||
private boolean isFullyQualified;
|
||||
private String signature;
|
||||
|
||||
|
||||
|
@ -103,7 +102,7 @@ public class CPPASTQualifiedName extends CPPASTNode implements
|
|||
|
||||
public char[] toCharArray() {
|
||||
if (names == null)
|
||||
return "".toCharArray(); //$NON-NLS-1$
|
||||
return new char[0];
|
||||
removeNullNames();
|
||||
|
||||
// count first
|
||||
|
@ -132,19 +131,20 @@ public class CPPASTQualifiedName extends CPPASTNode implements
|
|||
}
|
||||
|
||||
public boolean isFullyQualified() {
|
||||
return value;
|
||||
return isFullyQualified;
|
||||
}
|
||||
|
||||
public void setFullyQualified(boolean value) {
|
||||
this.value = value;
|
||||
public void setFullyQualified(boolean isFullyQualified) {
|
||||
this.isFullyQualified = isFullyQualified;
|
||||
}
|
||||
|
||||
|
||||
public void setValue(String string) {
|
||||
this.signature = string;
|
||||
public void setSignature(String signature) {
|
||||
this.signature = signature;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean accept(ASTVisitor action) {
|
||||
if (action.shouldVisitNames) {
|
||||
switch (action.visit(this)) {
|
||||
|
@ -317,10 +317,8 @@ public class CPPASTQualifiedName extends CPPASTNode implements
|
|||
}
|
||||
|
||||
private boolean nameMatches(char[] potential, char[] name, boolean isPrefix) {
|
||||
if (isPrefix) {
|
||||
if (isPrefix)
|
||||
return CharArrayUtils.equals(potential, 0, name.length, name, true);
|
||||
} else {
|
||||
return CharArrayUtils.equals(potential, name);
|
||||
}
|
||||
return CharArrayUtils.equals(potential, name);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2512,7 +2512,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
|
|||
protected ICPPASTQualifiedName createQualifiedName(ITokenDuple duple) {
|
||||
CPPASTQualifiedName result = new CPPASTQualifiedName();
|
||||
result.setOffsetAndLength(duple.getStartOffset(), duple.getEndOffset() - duple.getStartOffset());
|
||||
result.setValue(duple.toString());
|
||||
result.setSignature(duple.toString());
|
||||
ITokenDuple[] segments = duple.getSegments();
|
||||
int startingValue = 0;
|
||||
if (segments.length > 0) {
|
||||
|
|
Loading…
Add table
Reference in a new issue