Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Kucera2008-02-13 19:55:00 +0000
committerMike Kucera2008-02-13 19:55:00 +0000
commit4117aeccbdd34fbe4afe53a53fc2f5a530ade63d (patch)
tree7b54eae511931421365b6fe7d2fed81c1d4cbd8d /core/org.eclipse.cdt.core/parser
parent616efbbdbe5dd990e24fe0b1c7962a16a154ef92 (diff)
downloadorg.eclipse.cdt-4117aeccbdd34fbe4afe53a53fc2f5a530ade63d.tar.gz
org.eclipse.cdt-4117aeccbdd34fbe4afe53a53fc2f5a530ade63d.tar.xz
org.eclipse.cdt-4117aeccbdd34fbe4afe53a53fc2f5a530ade63d.zip
cleaned up CPPASTQualifiedName a bit
Diffstat (limited to 'core/org.eclipse.cdt.core/parser')
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTQualifiedName.java28
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GNUCPPSourceParser.java2
2 files changed, 14 insertions, 16 deletions
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTQualifiedName.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTQualifiedName.java
index 108998da038..3abf69c65fe 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTQualifiedName.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTQualifiedName.java
@@ -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);
}
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GNUCPPSourceParser.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GNUCPPSourceParser.java
index ed41b35e2a9..6d5c11dbf8d 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GNUCPPSourceParser.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GNUCPPSourceParser.java
@@ -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) {

Back to the top