mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 17:56:01 +02:00
Code streamlining.
This commit is contained in:
parent
290cf3472d
commit
af8f41dd1b
1 changed files with 8 additions and 13 deletions
|
@ -55,7 +55,6 @@ import org.eclipse.cdt.core.dom.ast.IEnumerator;
|
||||||
import org.eclipse.cdt.core.dom.ast.IFunction;
|
import org.eclipse.cdt.core.dom.ast.IFunction;
|
||||||
import org.eclipse.cdt.core.dom.ast.IType;
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
import org.eclipse.cdt.core.dom.ast.ITypedef;
|
import org.eclipse.cdt.core.dom.ast.ITypedef;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTName;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNameSpecifier;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNameSpecifier;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTQualifiedName;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTQualifiedName;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTUsingDeclaration;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTUsingDeclaration;
|
||||||
|
@ -478,24 +477,20 @@ public class IncludeCreator {
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean match(IASTName name, ArrayList<String> usingChain, boolean excludeLast) {
|
private boolean match(IASTName name, ArrayList<String> usingChain, boolean excludeLast) {
|
||||||
ICPPASTNameSpecifier[] names;
|
ICPPASTNameSpecifier[] qualifiers;
|
||||||
if (name instanceof ICPPASTQualifiedName) {
|
if (name instanceof ICPPASTQualifiedName) {
|
||||||
// OK to use getNames() here. 'name' comes from a namespace-scope
|
qualifiers = ((ICPPASTQualifiedName) name).getQualifier();
|
||||||
// using-declaration or using-directive, which cannot contain
|
|
||||||
// decltype-specifiers.
|
|
||||||
names = ((ICPPASTQualifiedName) name).getAllSegments();
|
|
||||||
} else {
|
} else {
|
||||||
names = new ICPPASTNameSpecifier[] { (ICPPASTName) name };
|
qualifiers = ICPPASTNameSpecifier.EMPTY_NAME_SPECIFIER_ARRAY;
|
||||||
}
|
}
|
||||||
if (names.length != usingChain.size() - (excludeLast ? 1 : 0)) {
|
if (qualifiers.length + 1 != usingChain.size() - (excludeLast ? 1 : 0))
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
for (int i = 0; i < names.length; i++) {
|
for (int i = 0; i < qualifiers.length; i++) {
|
||||||
if (!names[i].toString().equals(usingChain.get(usingChain.size() - 1 - i))) {
|
if (!qualifiers[i].toString().equals(usingChain.get(usingChain.size() - 1 - i)))
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return true;
|
return name.getLastName().toString().equals(usingChain.get(usingChain.size() - 1 - qualifiers.length));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Reference in a new issue