mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-09 09:15: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;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
|
@ -501,37 +500,35 @@ public class IndexUI {
|
|||
public static List<? extends IBinding> findSpecializations(IIndex index, IBinding binding) throws CoreException {
|
||||
List<IBinding> result= null;
|
||||
|
||||
// Check for instances of the given binding
|
||||
// Check for instances of the given binding.
|
||||
if (binding instanceof ICPPInstanceCache) {
|
||||
final List<ICPPTemplateInstance> instances= Arrays.asList(((ICPPInstanceCache) binding).getAllInstances());
|
||||
if (!instances.isEmpty()) {
|
||||
ICPPTemplateInstance[] instances= ((ICPPInstanceCache) binding).getAllInstances();
|
||||
for (ICPPTemplateInstance inst : instances) {
|
||||
if (!ASTInternal.hasDeclaration(inst)) {
|
||||
if (result == null)
|
||||
result= new ArrayList<IBinding>(instances.size());
|
||||
result= new ArrayList<IBinding>(instances.length);
|
||||
result.add(inst);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check for specializations of the owner
|
||||
// Check for specializations of the owner.
|
||||
IBinding owner = binding.getOwner();
|
||||
if (owner != null) {
|
||||
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) {
|
||||
// Add the specialized member
|
||||
// Add the specialized member.
|
||||
IBinding specializedMember = ((ICPPClassSpecialization) specOwner).specializeMember(binding, point);
|
||||
specializedMember= index.adaptBinding(specializedMember);
|
||||
if (specializedMember != null) {
|
||||
if (result == null)
|
||||
result= new ArrayList<IBinding>(findSpecializations(index, owner).size());
|
||||
result= new ArrayList<IBinding>(specializations.size());
|
||||
result.add(specializedMember);
|
||||
// Also add instances of the specialized member
|
||||
// Also add instances of the specialized member.
|
||||
if (specializedMember instanceof ICPPInstanceCache) {
|
||||
final List<ICPPTemplateInstance> instances= Arrays.asList(((ICPPInstanceCache) specializedMember).getAllInstances());
|
||||
if (!instances.isEmpty()) {
|
||||
ICPPTemplateInstance[] instances= ((ICPPInstanceCache) specializedMember).getAllInstances();
|
||||
for (ICPPTemplateInstance inst : instances) {
|
||||
if (!ASTInternal.hasDeclaration(inst)) {
|
||||
result.add(inst);
|
||||
|
@ -542,7 +539,6 @@ public class IndexUI {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (result != null) {
|
||||
return result;
|
||||
|
|
Loading…
Add table
Reference in a new issue