mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Fixes a few mistakes related to class specializations.
This commit is contained in:
parent
4a5e1d6fe1
commit
12d73e274c
5 changed files with 10 additions and 13 deletions
|
@ -31,7 +31,7 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPTemplates;
|
|||
* The result of instantiating a class template.
|
||||
*/
|
||||
public class CPPClassInstance extends CPPClassSpecialization implements ICPPTemplateInstance {
|
||||
private ICPPTemplateArgument[] arguments;
|
||||
private final ICPPTemplateArgument[] arguments;
|
||||
|
||||
public CPPClassInstance(ICPPClassType orig, IBinding owner, CPPTemplateParameterMap argMap, ICPPTemplateArgument[] args) {
|
||||
super(orig, owner, argMap);
|
||||
|
@ -52,6 +52,8 @@ public class CPPClassInstance extends CPPClassSpecialization implements ICPPTemp
|
|||
protected ICPPClassSpecializationScope getSpecializationScope() {
|
||||
// An instance with a declaration has no specialization scope.
|
||||
checkForDefinition();
|
||||
if (getDefinition() != null)
|
||||
return null;
|
||||
final IASTNode[] decls = getDeclarations();
|
||||
if (decls != null && decls.length > 0 && decls[0] != null)
|
||||
return null;
|
||||
|
|
|
@ -250,7 +250,7 @@ class BaseClassLookup {
|
|||
continue;
|
||||
|
||||
final IName nbaseName = nbase.getBaseClassSpecifierName();
|
||||
int cmp= baseName == null ? -1 : CPPSemantics.compareByRelevance(data, baseName, nbaseName);
|
||||
int cmp= baseName == null ? 0 : CPPSemantics.compareByRelevance(data, baseName, nbaseName);
|
||||
if (cmp <= 0) {
|
||||
if (cmp < 0) {
|
||||
selectedBases.clear();
|
||||
|
|
|
@ -30,11 +30,9 @@ import org.eclipse.cdt.core.dom.ast.IBinding;
|
|||
import org.eclipse.cdt.core.dom.ast.ICompositeType;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTConversionName;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassScope;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassTemplatePartialSpecialization;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPSpecialization;
|
||||
import org.eclipse.cdt.core.index.IIndexBinding;
|
||||
import org.eclipse.cdt.core.index.IIndexFileSet;
|
||||
import org.eclipse.cdt.core.index.IIndexName;
|
||||
|
@ -140,10 +138,6 @@ class PDOMCPPClassScope implements ICPPClassScope, IIndexScope {
|
|||
}
|
||||
|
||||
private IBinding getClassNameBinding() {
|
||||
if (fBinding instanceof ICPPClassTemplatePartialSpecialization)
|
||||
return ((ICPPClassTemplatePartialSpecialization) fBinding).getPrimaryClassTemplate();
|
||||
if (fBinding instanceof ICPPSpecialization)
|
||||
return ((ICPPSpecialization) fBinding).getSpecializedBinding();
|
||||
return fBinding;
|
||||
}
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ class PDOMCPPUsingDeclarationSpecialization extends PDOMCPPSpecialization implem
|
|||
|
||||
@Override
|
||||
public int getNodeType() {
|
||||
return IIndexCPPBindingConstants.CPP_USING_DECLARATION;
|
||||
return IIndexCPPBindingConstants.CPP_USING_DECLARATION_SPECIALIZATION;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -22,6 +22,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPField;
|
|||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateInstance;
|
||||
import org.eclipse.cdt.core.index.IndexFilter;
|
||||
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPDeferredClassInstance;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
|
||||
|
||||
|
@ -30,7 +31,7 @@ import org.eclipse.core.runtime.CoreException;
|
|||
*/
|
||||
class PDOMClassUtil {
|
||||
static class FieldCollector implements IPDOMVisitor {
|
||||
private List<ICPPField> fields = new ArrayList<ICPPField>();
|
||||
private final List<ICPPField> fields = new ArrayList<ICPPField>();
|
||||
@Override
|
||||
public boolean visit(IPDOMNode node) throws CoreException {
|
||||
if (node instanceof ICPPField) {
|
||||
|
@ -50,7 +51,7 @@ class PDOMClassUtil {
|
|||
}
|
||||
|
||||
static class ConstructorCollector implements IPDOMVisitor {
|
||||
private List<ICPPConstructor> fConstructors = new ArrayList<ICPPConstructor>();
|
||||
private final List<ICPPConstructor> fConstructors = new ArrayList<ICPPConstructor>();
|
||||
@Override
|
||||
public boolean visit(IPDOMNode node) throws CoreException {
|
||||
if (node instanceof ICPPConstructor) {
|
||||
|
@ -108,10 +109,10 @@ class PDOMClassUtil {
|
|||
}
|
||||
|
||||
static class NestedClassCollector implements IPDOMVisitor {
|
||||
private List<IPDOMNode> nestedClasses = new ArrayList<IPDOMNode>();
|
||||
private final List<IPDOMNode> nestedClasses = new ArrayList<IPDOMNode>();
|
||||
@Override
|
||||
public boolean visit(IPDOMNode node) throws CoreException {
|
||||
if (node instanceof ICPPClassType)
|
||||
if (node instanceof ICPPClassType && !(node instanceof ICPPDeferredClassInstance))
|
||||
nestedClasses.add(node);
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue