mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 09:46:02 +02:00
Cosmetics
Change-Id: Id86b562ee7b2b2b2944dd25e0178d4ecb452f5a8
This commit is contained in:
parent
aca869c045
commit
03bcd35cdf
3 changed files with 1290 additions and 1290 deletions
|
@ -57,23 +57,23 @@ public class CPPVariable extends PlatformObject implements ICPPInternalVariable
|
||||||
private boolean fAllResolved;
|
private boolean fAllResolved;
|
||||||
|
|
||||||
public CPPVariable(IASTName name) {
|
public CPPVariable(IASTName name) {
|
||||||
boolean isDef = name != null && name.isDefinition();
|
boolean isDef = name != null && name.isDefinition();
|
||||||
if (name instanceof ICPPASTQualifiedName) {
|
if (name instanceof ICPPASTQualifiedName) {
|
||||||
name = name.getLastName();
|
name = name.getLastName();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isDef) {
|
if (isDef) {
|
||||||
fDefinition = name;
|
fDefinition = name;
|
||||||
} else {
|
} else {
|
||||||
fDeclarations = new IASTName[] { name };
|
fDeclarations = new IASTName[] { name };
|
||||||
}
|
}
|
||||||
|
|
||||||
// Built-in variables supply a null.
|
// Built-in variables supply a null.
|
||||||
if (name != null) {
|
if (name != null) {
|
||||||
name.setBinding(this);
|
name.setBinding(this);
|
||||||
} else {
|
} else {
|
||||||
assert this instanceof CPPBuiltinVariable;
|
assert this instanceof CPPBuiltinVariable;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -100,15 +100,15 @@ public class CPPVariable extends PlatformObject implements ICPPInternalVariable
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IASTNode[] getDeclarations() {
|
public IASTNode[] getDeclarations() {
|
||||||
return fDeclarations;
|
return fDeclarations;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IASTNode getDefinition() {
|
public IASTNode getDefinition() {
|
||||||
return fDefinition;
|
return fDefinition;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IType getType() {
|
public IType getType() {
|
||||||
|
@ -130,10 +130,10 @@ public class CPPVariable extends PlatformObject implements ICPPInternalVariable
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public char[] getNameCharArray() {
|
public char[] getNameCharArray() {
|
||||||
if (fDeclarations != null) {
|
if (fDeclarations != null) {
|
||||||
return fDeclarations[0].getSimpleID();
|
return fDeclarations[0].getSimpleID();
|
||||||
}
|
}
|
||||||
return fDefinition.getSimpleID();
|
return fDefinition.getSimpleID();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -141,26 +141,26 @@ public class CPPVariable extends PlatformObject implements ICPPInternalVariable
|
||||||
return CPPVisitor.getContainingScope(fDefinition != null ? fDefinition : fDeclarations[0]);
|
return CPPVisitor.getContainingScope(fDefinition != null ? fDefinition : fDeclarations[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String[] getQualifiedName() {
|
public String[] getQualifiedName() {
|
||||||
return CPPVisitor.getQualifiedName(this);
|
return CPPVisitor.getQualifiedName(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public char[][] getQualifiedNameCharArray() {
|
public char[][] getQualifiedNameCharArray() {
|
||||||
return CPPVisitor.getQualifiedNameCharArray(this);
|
return CPPVisitor.getQualifiedNameCharArray(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isGloballyQualified() throws DOMException {
|
public boolean isGloballyQualified() throws DOMException {
|
||||||
IScope scope = getScope();
|
IScope scope = getScope();
|
||||||
while (scope != null) {
|
while (scope != null) {
|
||||||
if (scope instanceof ICPPBlockScope)
|
if (scope instanceof ICPPBlockScope)
|
||||||
return false;
|
return false;
|
||||||
scope = scope.getParent();
|
scope = scope.getParent();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addDefinition(IASTNode node) {
|
public void addDefinition(IASTNode node) {
|
||||||
|
@ -168,17 +168,17 @@ public class CPPVariable extends PlatformObject implements ICPPInternalVariable
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasStorageClass(int storage) {
|
public boolean hasStorageClass(int storage) {
|
||||||
IASTName name = (IASTName) getDefinition();
|
IASTName name = (IASTName) getDefinition();
|
||||||
IASTNode[] ns = getDeclarations();
|
IASTNode[] ns = getDeclarations();
|
||||||
|
|
||||||
return VariableHelpers.hasStorageClass(name, ns, storage);
|
return VariableHelpers.hasStorageClass(name, ns, storage);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isMutable() {
|
public boolean isMutable() {
|
||||||
// 7.1.1-8 the mutable specifier can only be applied to names of class data members.
|
// 7.1.1-8 the mutable specifier can only be applied to names of class data members.
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isConstexpr() {
|
public boolean isConstexpr() {
|
||||||
|
@ -190,25 +190,25 @@ public class CPPVariable extends PlatformObject implements ICPPInternalVariable
|
||||||
return hasStorageClass(IASTDeclSpecifier.sc_static);
|
return hasStorageClass(IASTDeclSpecifier.sc_static);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isExtern() {
|
public boolean isExtern() {
|
||||||
return hasStorageClass(IASTDeclSpecifier.sc_extern);
|
return hasStorageClass(IASTDeclSpecifier.sc_extern);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isExternC() {
|
public boolean isExternC() {
|
||||||
return CPPVisitor.isExternC(getDefinition(), getDeclarations());
|
return CPPVisitor.isExternC(getDefinition(), getDeclarations());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isAuto() {
|
public boolean isAuto() {
|
||||||
return hasStorageClass(IASTDeclSpecifier.sc_auto);
|
return hasStorageClass(IASTDeclSpecifier.sc_auto);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isRegister() {
|
public boolean isRegister() {
|
||||||
return hasStorageClass(IASTDeclSpecifier.sc_register);
|
return hasStorageClass(IASTDeclSpecifier.sc_register);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ILinkage getLinkage() {
|
public ILinkage getLinkage() {
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -724,14 +724,14 @@ public class CPPTemplates {
|
||||||
|
|
||||||
public static IBinding createBinding(ICPPASTTemplateParameter tp) {
|
public static IBinding createBinding(ICPPASTTemplateParameter tp) {
|
||||||
if (tp instanceof ICPPASTSimpleTypeTemplateParameter) {
|
if (tp instanceof ICPPASTSimpleTypeTemplateParameter) {
|
||||||
return new CPPTemplateTypeParameter(((ICPPASTSimpleTypeTemplateParameter) tp).getName(), tp.isParameterPack());
|
return new CPPTemplateTypeParameter(((ICPPASTSimpleTypeTemplateParameter) tp).getName(), tp.isParameterPack());
|
||||||
}
|
}
|
||||||
if (tp instanceof ICPPASTTemplatedTypeTemplateParameter) {
|
if (tp instanceof ICPPASTTemplatedTypeTemplateParameter) {
|
||||||
return new CPPTemplateTemplateParameter(((ICPPASTTemplatedTypeTemplateParameter) tp).getName(), tp.isParameterPack());
|
return new CPPTemplateTemplateParameter(((ICPPASTTemplatedTypeTemplateParameter) tp).getName(), tp.isParameterPack());
|
||||||
}
|
}
|
||||||
assert tp instanceof ICPPASTParameterDeclaration;
|
assert tp instanceof ICPPASTParameterDeclaration;
|
||||||
final IASTDeclarator dtor = ((ICPPASTParameterDeclaration) tp).getDeclarator();
|
final IASTDeclarator dtor = ((ICPPASTParameterDeclaration) tp).getDeclarator();
|
||||||
return new CPPTemplateNonTypeParameter(ASTQueries.findInnermostDeclarator(dtor).getName());
|
return new CPPTemplateNonTypeParameter(ASTQueries.findInnermostDeclarator(dtor).getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IBinding createBinding(ICPPASTTemplateId id) {
|
public static IBinding createBinding(ICPPASTTemplateId id) {
|
||||||
|
@ -848,7 +848,7 @@ public class CPPTemplates {
|
||||||
if (template instanceof ICPPClassTemplate) {
|
if (template instanceof ICPPClassTemplate) {
|
||||||
partialSpec = new CPPClassTemplatePartialSpecialization(id, args);
|
partialSpec = new CPPClassTemplatePartialSpecialization(id, args);
|
||||||
if (indexSpec != null) {
|
if (indexSpec != null) {
|
||||||
SemanticUtil.recordPartialSpecialization(indexSpec,
|
SemanticUtil.recordPartialSpecialization(indexSpec,
|
||||||
(ICPPClassTemplatePartialSpecialization) partialSpec, id);
|
(ICPPClassTemplatePartialSpecialization) partialSpec, id);
|
||||||
} else if (template instanceof ICPPInternalClassTemplate) {
|
} else if (template instanceof ICPPInternalClassTemplate) {
|
||||||
((ICPPInternalClassTemplate) template).addPartialSpecialization(
|
((ICPPInternalClassTemplate) template).addPartialSpecialization(
|
||||||
|
@ -1114,12 +1114,12 @@ public class CPPTemplates {
|
||||||
} else if (decl instanceof ITypedef) {
|
} else if (decl instanceof ITypedef) {
|
||||||
InstantiationContext context = createInstantiationContext(tpMap, owner, point);
|
InstantiationContext context = createInstantiationContext(tpMap, owner, point);
|
||||||
IType type= instantiateType(((ITypedef) decl).getType(), context);
|
IType type= instantiateType(((ITypedef) decl).getType(), context);
|
||||||
spec = new CPPTypedefSpecialization(decl, owner, tpMap, type);
|
spec = new CPPTypedefSpecialization(decl, owner, tpMap, type);
|
||||||
} else if (decl instanceof ICPPAliasTemplate) {
|
} else if (decl instanceof ICPPAliasTemplate) {
|
||||||
ICPPAliasTemplate aliasTemplate = (ICPPAliasTemplate) decl;
|
ICPPAliasTemplate aliasTemplate = (ICPPAliasTemplate) decl;
|
||||||
InstantiationContext context = createInstantiationContext(tpMap, owner, point);
|
InstantiationContext context = createInstantiationContext(tpMap, owner, point);
|
||||||
IType type= instantiateType(aliasTemplate.getType(), context);
|
IType type= instantiateType(aliasTemplate.getType(), context);
|
||||||
spec = new CPPAliasTemplateInstance(decl.getNameCharArray(), aliasTemplate, type);
|
spec = new CPPAliasTemplateInstance(decl.getNameCharArray(), aliasTemplate, type);
|
||||||
} else if (decl instanceof ICPPEnumeration && classOwner != null) {
|
} else if (decl instanceof ICPPEnumeration && classOwner != null) {
|
||||||
// TODO: Handle local enumerations
|
// TODO: Handle local enumerations
|
||||||
spec = CPPEnumerationSpecialization.createInstance((ICPPEnumeration) decl, classOwner, tpMap, point);
|
spec = CPPEnumerationSpecialization.createInstance((ICPPEnumeration) decl, classOwner, tpMap, point);
|
||||||
|
@ -2088,7 +2088,7 @@ public class CPPTemplates {
|
||||||
private static ICPPASTInternalTemplateDeclaration getInnerTemplateDeclaration(final IASTName name) {
|
private static ICPPASTInternalTemplateDeclaration getInnerTemplateDeclaration(final IASTName name) {
|
||||||
IASTNode parent = name.getParent();
|
IASTNode parent = name.getParent();
|
||||||
while (parent instanceof IASTName) {
|
while (parent instanceof IASTName) {
|
||||||
parent = parent.getParent();
|
parent = parent.getParent();
|
||||||
}
|
}
|
||||||
if (parent instanceof IASTDeclSpecifier) {
|
if (parent instanceof IASTDeclSpecifier) {
|
||||||
if (!(parent instanceof IASTCompositeTypeSpecifier) &&
|
if (!(parent instanceof IASTCompositeTypeSpecifier) &&
|
||||||
|
@ -2098,7 +2098,7 @@ public class CPPTemplates {
|
||||||
parent = parent.getParent();
|
parent = parent.getParent();
|
||||||
} else {
|
} else {
|
||||||
while (parent instanceof IASTDeclarator) {
|
while (parent instanceof IASTDeclarator) {
|
||||||
parent = parent.getParent();
|
parent = parent.getParent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!(parent instanceof IASTDeclaration))
|
if (!(parent instanceof IASTDeclaration))
|
||||||
|
@ -2121,11 +2121,11 @@ public class CPPTemplates {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IASTName getTemplateName(ICPPASTTemplateDeclaration templateDecl) {
|
public static IASTName getTemplateName(ICPPASTTemplateDeclaration templateDecl) {
|
||||||
if (templateDecl == null) return null;
|
if (templateDecl == null) return null;
|
||||||
|
|
||||||
ICPPASTTemplateDeclaration decl = templateDecl;
|
ICPPASTTemplateDeclaration decl = templateDecl;
|
||||||
while (decl.getParent() instanceof ICPPASTTemplateDeclaration)
|
while (decl.getParent() instanceof ICPPASTTemplateDeclaration)
|
||||||
decl = (ICPPASTTemplateDeclaration) decl.getParent();
|
decl = (ICPPASTTemplateDeclaration) decl.getParent();
|
||||||
|
|
||||||
IASTDeclaration nestedDecl = templateDecl.getDeclaration();
|
IASTDeclaration nestedDecl = templateDecl.getDeclaration();
|
||||||
while (nestedDecl instanceof ICPPASTTemplateDeclaration) {
|
while (nestedDecl instanceof ICPPASTTemplateDeclaration) {
|
||||||
|
@ -2134,27 +2134,27 @@ public class CPPTemplates {
|
||||||
|
|
||||||
IASTName name = null;
|
IASTName name = null;
|
||||||
if (nestedDecl instanceof IASTSimpleDeclaration) {
|
if (nestedDecl instanceof IASTSimpleDeclaration) {
|
||||||
IASTSimpleDeclaration simple = (IASTSimpleDeclaration) nestedDecl;
|
IASTSimpleDeclaration simple = (IASTSimpleDeclaration) nestedDecl;
|
||||||
if (simple.getDeclarators().length == 1) {
|
if (simple.getDeclarators().length == 1) {
|
||||||
IASTDeclarator dtor = simple.getDeclarators()[0];
|
IASTDeclarator dtor = simple.getDeclarators()[0];
|
||||||
while (dtor.getNestedDeclarator() != null)
|
while (dtor.getNestedDeclarator() != null)
|
||||||
dtor = dtor.getNestedDeclarator();
|
dtor = dtor.getNestedDeclarator();
|
||||||
name = dtor.getName();
|
name = dtor.getName();
|
||||||
} else if (simple.getDeclarators().length == 0) {
|
} else if (simple.getDeclarators().length == 0) {
|
||||||
IASTDeclSpecifier spec = simple.getDeclSpecifier();
|
IASTDeclSpecifier spec = simple.getDeclSpecifier();
|
||||||
if (spec instanceof ICPPASTCompositeTypeSpecifier) {
|
if (spec instanceof ICPPASTCompositeTypeSpecifier) {
|
||||||
name = ((ICPPASTCompositeTypeSpecifier) spec).getName();
|
name = ((ICPPASTCompositeTypeSpecifier) spec).getName();
|
||||||
} else if (spec instanceof ICPPASTElaboratedTypeSpecifier) {
|
} else if (spec instanceof ICPPASTElaboratedTypeSpecifier) {
|
||||||
name = ((ICPPASTElaboratedTypeSpecifier) spec).getName();
|
name = ((ICPPASTElaboratedTypeSpecifier) spec).getName();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (nestedDecl instanceof IASTFunctionDefinition) {
|
} else if (nestedDecl instanceof IASTFunctionDefinition) {
|
||||||
IASTDeclarator declarator = ((IASTFunctionDefinition) nestedDecl).getDeclarator();
|
IASTDeclarator declarator = ((IASTFunctionDefinition) nestedDecl).getDeclarator();
|
||||||
declarator= ASTQueries.findInnermostDeclarator(declarator);
|
declarator= ASTQueries.findInnermostDeclarator(declarator);
|
||||||
name = declarator.getName();
|
name = declarator.getName();
|
||||||
}
|
}
|
||||||
if (name != null) {
|
if (name != null) {
|
||||||
if (name instanceof ICPPASTQualifiedName) {
|
if (name instanceof ICPPASTQualifiedName) {
|
||||||
ICPPASTNameSpecifier[] qualifier = ((ICPPASTQualifiedName) name).getQualifier();
|
ICPPASTNameSpecifier[] qualifier = ((ICPPASTQualifiedName) name).getQualifier();
|
||||||
IASTDeclaration currDecl = decl;
|
IASTDeclaration currDecl = decl;
|
||||||
for (ICPPASTNameSpecifier segment : qualifier) {
|
for (ICPPASTNameSpecifier segment : qualifier) {
|
||||||
|
@ -2171,9 +2171,9 @@ public class CPPTemplates {
|
||||||
if (currDecl == templateDecl) {
|
if (currDecl == templateDecl) {
|
||||||
return name.getLastName();
|
return name.getLastName();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
@ -2193,7 +2193,7 @@ public class CPPTemplates {
|
||||||
/**
|
/**
|
||||||
* @param id the template id containing the template arguments
|
* @param id the template id containing the template arguments
|
||||||
* @return an array of template arguments, currently modeled as IType objects.
|
* @return an array of template arguments, currently modeled as IType objects.
|
||||||
* The empty ICPPTemplateArgument array is returned if id is {@code null}
|
* The empty ICPPTemplateArgument array is returned if id is {@code null}
|
||||||
*/
|
*/
|
||||||
public static ICPPTemplateArgument[] createTemplateArgumentArray(ICPPASTTemplateId id) throws DOMException {
|
public static ICPPTemplateArgument[] createTemplateArgumentArray(ICPPASTTemplateId id) throws DOMException {
|
||||||
ICPPTemplateArgument[] result= ICPPTemplateArgument.EMPTY_ARGUMENTS;
|
ICPPTemplateArgument[] result= ICPPTemplateArgument.EMPTY_ARGUMENTS;
|
||||||
|
@ -2510,7 +2510,7 @@ public class CPPTemplates {
|
||||||
return (f instanceof ICPPMethod) && !((ICPPMethod) f).isStatic();
|
return (f instanceof ICPPMethod) && !((ICPPMethod) f).isStatic();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ICPPPartialSpecialization findPartialSpecialization(ICPPPartiallySpecializable template,
|
private static ICPPPartialSpecialization findPartialSpecialization(ICPPPartiallySpecializable template,
|
||||||
ICPPTemplateArgument[] args) throws DOMException {
|
ICPPTemplateArgument[] args) throws DOMException {
|
||||||
ICPPPartialSpecialization[] pspecs = template.getPartialSpecializations();
|
ICPPPartialSpecialization[] pspecs = template.getPartialSpecializations();
|
||||||
if (pspecs != null && pspecs.length > 0) {
|
if (pspecs != null && pspecs.length > 0) {
|
||||||
|
@ -2567,7 +2567,7 @@ public class CPPTemplates {
|
||||||
if (bestMatch instanceof ICPPClassTemplatePartialSpecialization) {
|
if (bestMatch instanceof ICPPClassTemplatePartialSpecialization) {
|
||||||
bestMatch = SemanticUtil.mapToAST((ICPPClassTemplatePartialSpecialization) bestMatch, point);
|
bestMatch = SemanticUtil.mapToAST((ICPPClassTemplatePartialSpecialization) bestMatch, point);
|
||||||
}
|
}
|
||||||
|
|
||||||
return instantiatePartialSpecialization(bestMatch, args, isDef, bestMap, point);
|
return instantiatePartialSpecialization(bestMatch, args, isDef, bestMap, point);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2777,8 +2777,8 @@ public class CPPTemplates {
|
||||||
IType p;
|
IType p;
|
||||||
if (paramType instanceof IFunctionType) {
|
if (paramType instanceof IFunctionType) {
|
||||||
p = new CPPPointerType(paramType);
|
p = new CPPPointerType(paramType);
|
||||||
} else if (paramType instanceof IArrayType) {
|
} else if (paramType instanceof IArrayType) {
|
||||||
p = new CPPPointerType(((IArrayType) paramType).getType());
|
p = new CPPPointerType(((IArrayType) paramType).getType());
|
||||||
} else {
|
} else {
|
||||||
p= paramType;
|
p= paramType;
|
||||||
if (p != null && p.isSameType(a))
|
if (p != null && p.isSameType(a))
|
||||||
|
@ -2930,81 +2930,81 @@ public class CPPTemplates {
|
||||||
*/
|
*/
|
||||||
public static IBinding resolveUnknown(ICPPUnknownBinding unknown, InstantiationContext context)
|
public static IBinding resolveUnknown(ICPPUnknownBinding unknown, InstantiationContext context)
|
||||||
throws DOMException {
|
throws DOMException {
|
||||||
if (unknown instanceof ICPPDeferredClassInstance) {
|
if (unknown instanceof ICPPDeferredClassInstance) {
|
||||||
return resolveDeferredClassInstance((ICPPDeferredClassInstance) unknown, context);
|
return resolveDeferredClassInstance((ICPPDeferredClassInstance) unknown, context);
|
||||||
}
|
}
|
||||||
if (unknown instanceof ICPPUnknownMember) {
|
if (unknown instanceof ICPPUnknownMember) {
|
||||||
return resolveUnknownMember((ICPPUnknownMember) unknown, context);
|
return resolveUnknownMember((ICPPUnknownMember) unknown, context);
|
||||||
}
|
}
|
||||||
if (unknown instanceof ICPPTemplateParameter && unknown instanceof IType) {
|
if (unknown instanceof ICPPTemplateParameter && unknown instanceof IType) {
|
||||||
IType type= resolveTemplateTypeParameter((ICPPTemplateParameter) unknown, context);
|
IType type= resolveTemplateTypeParameter((ICPPTemplateParameter) unknown, context);
|
||||||
if (type instanceof IBinding)
|
if (type instanceof IBinding)
|
||||||
return (IBinding) type;
|
return (IBinding) type;
|
||||||
}
|
}
|
||||||
if (unknown instanceof TypeOfDependentExpression) {
|
if (unknown instanceof TypeOfDependentExpression) {
|
||||||
IType type= instantiateType((IType) unknown, context);
|
IType type= instantiateType((IType) unknown, context);
|
||||||
if (type instanceof IBinding)
|
if (type instanceof IBinding)
|
||||||
return (IBinding) type;
|
return (IBinding) type;
|
||||||
}
|
}
|
||||||
return unknown;
|
return unknown;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static IBinding resolveUnknownMember(ICPPUnknownMember unknown, InstantiationContext context)
|
private static IBinding resolveUnknownMember(ICPPUnknownMember unknown, InstantiationContext context)
|
||||||
throws DOMException {
|
throws DOMException {
|
||||||
final IType ot0= unknown.getOwnerType();
|
final IType ot0= unknown.getOwnerType();
|
||||||
if (ot0 == null)
|
if (ot0 == null)
|
||||||
return unknown;
|
return unknown;
|
||||||
|
|
||||||
IBinding result = unknown;
|
IBinding result = unknown;
|
||||||
IType ot1 = instantiateType(ot0, context);
|
IType ot1 = instantiateType(ot0, context);
|
||||||
if (ot1 != null) {
|
if (ot1 != null) {
|
||||||
ot1 = SemanticUtil.getUltimateType(ot1, false);
|
ot1 = SemanticUtil.getUltimateType(ot1, false);
|
||||||
if (ot1 instanceof ICPPUnknownType) {
|
if (ot1 instanceof ICPPUnknownType) {
|
||||||
if (unknown instanceof ICPPUnknownMemberClassInstance) {
|
if (unknown instanceof ICPPUnknownMemberClassInstance) {
|
||||||
ICPPUnknownMemberClassInstance ucli= (ICPPUnknownMemberClassInstance) unknown;
|
ICPPUnknownMemberClassInstance ucli= (ICPPUnknownMemberClassInstance) unknown;
|
||||||
ICPPTemplateArgument[] args0 = ucli.getArguments();
|
ICPPTemplateArgument[] args0 = ucli.getArguments();
|
||||||
ICPPTemplateArgument[] args1 = instantiateArguments(args0, context, false);
|
ICPPTemplateArgument[] args1 = instantiateArguments(args0, context, false);
|
||||||
if (args0 != args1 || !ot1.isSameType(ot0)) {
|
if (args0 != args1 || !ot1.isSameType(ot0)) {
|
||||||
args1= SemanticUtil.getSimplifiedArguments(args1);
|
args1= SemanticUtil.getSimplifiedArguments(args1);
|
||||||
result= new CPPUnknownClassInstance(ot1, ucli.getNameCharArray(), args1);
|
result= new CPPUnknownClassInstance(ot1, ucli.getNameCharArray(), args1);
|
||||||
}
|
}
|
||||||
} else if (!ot1.isSameType(ot0)) {
|
} else if (!ot1.isSameType(ot0)) {
|
||||||
if (unknown instanceof ICPPUnknownMemberClass) {
|
if (unknown instanceof ICPPUnknownMemberClass) {
|
||||||
result= new CPPUnknownMemberClass(ot1, unknown.getNameCharArray());
|
result= new CPPUnknownMemberClass(ot1, unknown.getNameCharArray());
|
||||||
} else {
|
} else {
|
||||||
result= new CPPUnknownMethod(ot1, unknown.getNameCharArray());
|
result= new CPPUnknownMethod(ot1, unknown.getNameCharArray());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (ot1 instanceof ICPPClassType) {
|
} else if (ot1 instanceof ICPPClassType) {
|
||||||
IScope s = ((ICPPClassType) ot1).getCompositeScope();
|
IScope s = ((ICPPClassType) ot1).getCompositeScope();
|
||||||
if (s != null) {
|
if (s != null) {
|
||||||
result= CPPSemantics.resolveUnknownName(s, unknown, context.getPoint());
|
result= CPPSemantics.resolveUnknownName(s, unknown, context.getPoint());
|
||||||
if (unknown instanceof ICPPUnknownMemberClassInstance &&
|
if (unknown instanceof ICPPUnknownMemberClassInstance &&
|
||||||
(result instanceof ICPPTemplateDefinition ||
|
(result instanceof ICPPTemplateDefinition ||
|
||||||
result instanceof ICPPAliasTemplateInstance)) {
|
result instanceof ICPPAliasTemplateInstance)) {
|
||||||
ICPPTemplateArgument[] args1 = instantiateArguments(
|
ICPPTemplateArgument[] args1 = instantiateArguments(
|
||||||
((ICPPUnknownMemberClassInstance) unknown).getArguments(), context, false);
|
((ICPPUnknownMemberClassInstance) unknown).getArguments(), context, false);
|
||||||
if (result instanceof ICPPClassTemplate) {
|
if (result instanceof ICPPClassTemplate) {
|
||||||
result = instantiate((ICPPClassTemplate) result, args1, context.getPoint());
|
result = instantiate((ICPPClassTemplate) result, args1, context.getPoint());
|
||||||
} else if (result instanceof ICPPAliasTemplate) {
|
} else if (result instanceof ICPPAliasTemplate) {
|
||||||
result = instantiateAliasTemplate((ICPPAliasTemplate) result, args1,
|
result = instantiateAliasTemplate((ICPPAliasTemplate) result, args1,
|
||||||
context.getPoint());
|
context.getPoint());
|
||||||
} else if (result instanceof ICPPAliasTemplateInstance) {
|
} else if (result instanceof ICPPAliasTemplateInstance) {
|
||||||
// TODO(nathanridge): Remove this branch once we properly represent
|
// TODO(nathanridge): Remove this branch once we properly represent
|
||||||
// specializations of alias templates (which will then implement
|
// specializations of alias templates (which will then implement
|
||||||
// ICPPAliasTemplate and be caught by the previous branch).
|
// ICPPAliasTemplate and be caught by the previous branch).
|
||||||
result = instantiateAliasTemplateInstance((ICPPAliasTemplateInstance) result,
|
result = instantiateAliasTemplateInstance((ICPPAliasTemplateInstance) result,
|
||||||
args1, context.getPoint());
|
args1, context.getPoint());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (ot1 != ot0) {
|
} else if (ot1 != ot0) {
|
||||||
return new ProblemBinding(new CPPASTName(unknown.getNameCharArray()), context.getPoint(),
|
return new ProblemBinding(new CPPASTName(unknown.getNameCharArray()), context.getPoint(),
|
||||||
IProblemBinding.SEMANTIC_BAD_SCOPE);
|
IProblemBinding.SEMANTIC_BAD_SCOPE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static IBinding resolveDeferredClassInstance(ICPPDeferredClassInstance dci, InstantiationContext context) {
|
private static IBinding resolveDeferredClassInstance(ICPPDeferredClassInstance dci, InstantiationContext context) {
|
||||||
|
@ -3133,7 +3133,7 @@ public class CPPTemplates {
|
||||||
}
|
}
|
||||||
return exec;
|
return exec;
|
||||||
}
|
}
|
||||||
private static void addInstantiatedParameters(InstantiationContext context,
|
private static void addInstantiatedParameters(InstantiationContext context,
|
||||||
ICPPFunctionSpecialization spec) {
|
ICPPFunctionSpecialization spec) {
|
||||||
ICPPFunction specialized = (ICPPFunction) spec.getSpecializedBinding();
|
ICPPFunction specialized = (ICPPFunction) spec.getSpecializedBinding();
|
||||||
ICPPParameter paramSpecs[] = spec.getParameters();
|
ICPPParameter paramSpecs[] = spec.getParameters();
|
||||||
|
|
Loading…
Add table
Reference in a new issue