mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-09 17:25:38 +02:00
Code streamlining.
This commit is contained in:
parent
1e9005bdc8
commit
20e35e3e42
1 changed files with 20 additions and 24 deletions
|
@ -13,7 +13,6 @@
|
||||||
package org.eclipse.cdt.internal.ui.viewsupport;
|
package org.eclipse.cdt.internal.ui.viewsupport;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
@ -501,37 +500,35 @@ public class IndexUI {
|
||||||
public static List<? extends IBinding> findSpecializations(IIndex index, IBinding binding) throws CoreException {
|
public static List<? extends IBinding> findSpecializations(IIndex index, IBinding binding) throws CoreException {
|
||||||
List<IBinding> result= null;
|
List<IBinding> result= null;
|
||||||
|
|
||||||
// Check for instances of the given binding
|
// Check for instances of the given binding.
|
||||||
if (binding instanceof ICPPInstanceCache) {
|
if (binding instanceof ICPPInstanceCache) {
|
||||||
final List<ICPPTemplateInstance> instances= Arrays.asList(((ICPPInstanceCache) binding).getAllInstances());
|
ICPPTemplateInstance[] instances= ((ICPPInstanceCache) binding).getAllInstances();
|
||||||
if (!instances.isEmpty()) {
|
|
||||||
for (ICPPTemplateInstance inst : instances) {
|
for (ICPPTemplateInstance inst : instances) {
|
||||||
if (!ASTInternal.hasDeclaration(inst)) {
|
if (!ASTInternal.hasDeclaration(inst)) {
|
||||||
if (result == null)
|
if (result == null)
|
||||||
result= new ArrayList<IBinding>(instances.size());
|
result= new ArrayList<IBinding>(instances.length);
|
||||||
result.add(inst);
|
result.add(inst);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Check for specializations of the owner
|
// Check for specializations of the owner.
|
||||||
IBinding owner = binding.getOwner();
|
IBinding owner = binding.getOwner();
|
||||||
if (owner != null) {
|
if (owner != null) {
|
||||||
IASTNode point= null; // Instantiation of dependent expressions may not work.
|
IASTNode point= null; // Instantiation of dependent expressions may not work.
|
||||||
for (IBinding specOwner : findSpecializations(index, owner)) {
|
List<? extends IBinding> specializations = findSpecializations(index, owner);
|
||||||
|
for (IBinding specOwner : specializations) {
|
||||||
if (specOwner instanceof ICPPClassSpecialization) {
|
if (specOwner instanceof ICPPClassSpecialization) {
|
||||||
// Add the specialized member
|
// Add the specialized member.
|
||||||
IBinding specializedMember = ((ICPPClassSpecialization) specOwner).specializeMember(binding, point);
|
IBinding specializedMember = ((ICPPClassSpecialization) specOwner).specializeMember(binding, point);
|
||||||
specializedMember= index.adaptBinding(specializedMember);
|
specializedMember= index.adaptBinding(specializedMember);
|
||||||
if (specializedMember != null) {
|
if (specializedMember != null) {
|
||||||
if (result == null)
|
if (result == null)
|
||||||
result= new ArrayList<IBinding>(findSpecializations(index, owner).size());
|
result= new ArrayList<IBinding>(specializations.size());
|
||||||
result.add(specializedMember);
|
result.add(specializedMember);
|
||||||
// Also add instances of the specialized member
|
// Also add instances of the specialized member.
|
||||||
if (specializedMember instanceof ICPPInstanceCache) {
|
if (specializedMember instanceof ICPPInstanceCache) {
|
||||||
final List<ICPPTemplateInstance> instances= Arrays.asList(((ICPPInstanceCache) specializedMember).getAllInstances());
|
ICPPTemplateInstance[] instances= ((ICPPInstanceCache) specializedMember).getAllInstances();
|
||||||
if (!instances.isEmpty()) {
|
|
||||||
for (ICPPTemplateInstance inst : instances) {
|
for (ICPPTemplateInstance inst : instances) {
|
||||||
if (!ASTInternal.hasDeclaration(inst)) {
|
if (!ASTInternal.hasDeclaration(inst)) {
|
||||||
result.add(inst);
|
result.add(inst);
|
||||||
|
@ -542,7 +539,6 @@ public class IndexUI {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
return result;
|
return result;
|
||||||
|
|
Loading…
Add table
Reference in a new issue