mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-09 09:15:38 +02:00
Code streamlining.
Change-Id: I7a90e1b97d65813c80a52dfc36fc368bc20a7399
This commit is contained in:
parent
7c859a9b92
commit
f838c07db6
1 changed files with 16 additions and 33 deletions
|
@ -10,6 +10,7 @@
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
* Bryan Wilkinson (QNX)
|
* Bryan Wilkinson (QNX)
|
||||||
* Anton Leherbauer (Wind River Systems)
|
* Anton Leherbauer (Wind River Systems)
|
||||||
|
* Sergey Prigogin (Google)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||||
|
|
||||||
|
@ -94,18 +95,16 @@ public class CPPASTName extends CPPASTNameBase implements ICPPASTCompletionConte
|
||||||
return filterByElaboratedTypeSpecifier(kind, bindings);
|
return filterByElaboratedTypeSpecifier(kind, bindings);
|
||||||
} else if (parent instanceof IASTDeclarator) {
|
} else if (parent instanceof IASTDeclarator) {
|
||||||
IBinding[] bindings = CPPSemantics.findBindingsForContentAssist(n, isPrefix, namespaces);
|
IBinding[] bindings = CPPSemantics.findBindingsForContentAssist(n, isPrefix, namespaces);
|
||||||
if (!isPrefix) {
|
if (isPrefix) {
|
||||||
// The lookup does not find the binding, that is defined by this name
|
|
||||||
if (bindings.length == 0) {
|
|
||||||
bindings= new IBinding[] {n.resolveBinding()};
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
for (int i = 0; i < bindings.length; i++) {
|
for (int i = 0; i < bindings.length; i++) {
|
||||||
if (bindings[i] instanceof ICPPNamespace || bindings[i] instanceof ICPPClassType) {
|
IBinding binding = bindings[i];
|
||||||
} else {
|
if (!(binding instanceof ICPPNamespace) && !(binding instanceof ICPPClassType)) {
|
||||||
bindings[i] = null;
|
bindings[i] = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (bindings.length == 0) {
|
||||||
|
// The lookup did not find the binding that is defined by this name.
|
||||||
|
bindings= new IBinding[] { n.resolveBinding() };
|
||||||
}
|
}
|
||||||
return ArrayUtil.removeNulls(IBinding.class, bindings);
|
return ArrayUtil.removeNulls(IBinding.class, bindings);
|
||||||
}
|
}
|
||||||
|
@ -114,27 +113,11 @@ public class CPPASTName extends CPPASTNameBase implements ICPPASTCompletionConte
|
||||||
|
|
||||||
private IBinding[] filterByElaboratedTypeSpecifier(int kind, IBinding[] bindings) {
|
private IBinding[] filterByElaboratedTypeSpecifier(int kind, IBinding[] bindings) {
|
||||||
for (int i = 0; i < bindings.length; i++) {
|
for (int i = 0; i < bindings.length; i++) {
|
||||||
if (bindings[i] instanceof ICPPNamespace) {
|
IBinding binding = bindings[i];
|
||||||
} else if (bindings[i] instanceof ICPPClassType) {
|
if (binding instanceof ICPPClassType) {
|
||||||
ICPPClassType type = (ICPPClassType) bindings[i];
|
if (((ICPPClassType) binding).getKey() != kind)
|
||||||
switch (type.getKey()) {
|
|
||||||
case ICompositeType.k_struct:
|
|
||||||
if (kind != ICompositeType.k_struct) {
|
|
||||||
bindings[i] = null;
|
bindings[i] = null;
|
||||||
}
|
} else if (!(binding instanceof ICPPNamespace)) {
|
||||||
break;
|
|
||||||
case ICompositeType.k_union:
|
|
||||||
if (kind != ICompositeType.k_union) {
|
|
||||||
bindings[i] = null;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case ICPPClassType.k_class:
|
|
||||||
if (kind != ICPPASTElaboratedTypeSpecifier.k_class) {
|
|
||||||
bindings[i] = null;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
bindings[i]= null;
|
bindings[i]= null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue