mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Cosmetics.
This commit is contained in:
parent
27dfb6801e
commit
e7c0e1fb81
2 changed files with 24 additions and 28 deletions
|
@ -161,14 +161,14 @@ public class CPPTemplates {
|
||||||
static enum TypeSelection { PARAMETERS, RETURN_TYPE, PARAMETERS_AND_RETURN_TYPE }
|
static enum TypeSelection { PARAMETERS, RETURN_TYPE, PARAMETERS_AND_RETURN_TYPE }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a class template with the given arguments. May return <code>null</code>.
|
* Instantiates a class template with the given arguments. May return {@code null}.
|
||||||
*/
|
*/
|
||||||
public static IBinding instantiate(ICPPClassTemplate template, ICPPTemplateArgument[] args, IASTNode point) {
|
public static IBinding instantiate(ICPPClassTemplate template, ICPPTemplateArgument[] args, IASTNode point) {
|
||||||
return instantiate(template, args, false, false, point);
|
return instantiate(template, args, false, false, point);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a class template with the given arguments. May return <code>null</code>.
|
* Instantiates a class template with the given arguments. May return {@code null}.
|
||||||
*/
|
*/
|
||||||
private static IBinding instantiate(ICPPClassTemplate template, ICPPTemplateArgument[] args,
|
private static IBinding instantiate(ICPPClassTemplate template, ICPPTemplateArgument[] args,
|
||||||
boolean isDefinition, boolean isExplicitSpecialization, IASTNode point) {
|
boolean isDefinition, boolean isExplicitSpecialization, IASTNode point) {
|
||||||
|
@ -321,7 +321,6 @@ public class CPPTemplates {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a partial class template specialization.
|
* Instantiates a partial class template specialization.
|
||||||
* @param point
|
|
||||||
*/
|
*/
|
||||||
private static IBinding instantiatePartialSpecialization(
|
private static IBinding instantiatePartialSpecialization(
|
||||||
ICPPClassTemplatePartialSpecialization partialSpec, ICPPTemplateArgument[] args, boolean isDef,
|
ICPPClassTemplatePartialSpecialization partialSpec, ICPPTemplateArgument[] args, boolean isDef,
|
||||||
|
@ -343,12 +342,11 @@ public class CPPTemplates {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates the selected template, without looking for specializations. May return <code>null</code>.
|
* Instantiates the selected template, without looking for specializations.
|
||||||
* @param map
|
* May return {@code null}.
|
||||||
*/
|
*/
|
||||||
private static IBinding instantiatePrimaryTemplate(ICPPClassTemplate template, ICPPTemplateArgument[] arguments,
|
private static IBinding instantiatePrimaryTemplate(ICPPClassTemplate template, ICPPTemplateArgument[] arguments,
|
||||||
CPPTemplateParameterMap map, boolean isDef, IASTNode point) throws DOMException {
|
CPPTemplateParameterMap map, boolean isDef, IASTNode point) throws DOMException {
|
||||||
|
|
||||||
assert !(template instanceof ICPPClassTemplatePartialSpecialization);
|
assert !(template instanceof ICPPClassTemplatePartialSpecialization);
|
||||||
ICPPTemplateInstance instance= getInstance(template, arguments, isDef);
|
ICPPTemplateInstance instance= getInstance(template, arguments, isDef);
|
||||||
if (instance != null) {
|
if (instance != null) {
|
||||||
|
@ -598,7 +596,7 @@ public class CPPTemplates {
|
||||||
|
|
||||||
public static IBinding createBinding(ICPPASTTemplateId id) {
|
public static IBinding createBinding(ICPPASTTemplateId id) {
|
||||||
if (!isClassTemplate(id)) {
|
if (!isClassTemplate(id)) {
|
||||||
//functions are instantiated as part of the resolution process
|
// Functions are instantiated as part of the resolution process.
|
||||||
IBinding result= CPPVisitor.createBinding(id);
|
IBinding result= CPPVisitor.createBinding(id);
|
||||||
IASTName templateName = id.getTemplateName();
|
IASTName templateName = id.getTemplateName();
|
||||||
if (result instanceof ICPPClassTemplate) {
|
if (result instanceof ICPPClassTemplate) {
|
||||||
|
@ -643,7 +641,7 @@ public class CPPTemplates {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
// class template instance
|
// Class template instance.
|
||||||
IBinding result= null;
|
IBinding result= null;
|
||||||
IASTName templateName = id.getTemplateName();
|
IASTName templateName = id.getTemplateName();
|
||||||
IBinding template = templateName.resolvePreBinding();
|
IBinding template = templateName.resolvePreBinding();
|
||||||
|
@ -976,10 +974,10 @@ public class CPPTemplates {
|
||||||
* Instantiates types contained in an array.
|
* Instantiates types contained in an array.
|
||||||
* @param types an array of types
|
* @param types an array of types
|
||||||
* @param tpMap template argument map
|
* @param tpMap template argument map
|
||||||
* @param point
|
|
||||||
* @return an array containing instantiated types.
|
* @return an array containing instantiated types.
|
||||||
*/
|
*/
|
||||||
public static IType[] instantiateTypes(IType[] types, ICPPTemplateParameterMap tpMap, int packOffset, ICPPClassSpecialization within, IASTNode point) {
|
public static IType[] instantiateTypes(IType[] types, ICPPTemplateParameterMap tpMap,
|
||||||
|
int packOffset, ICPPClassSpecialization within, IASTNode point) {
|
||||||
if (types == null)
|
if (types == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
@ -1024,7 +1022,6 @@ public class CPPTemplates {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates arguments contained in an array.
|
* Instantiates arguments contained in an array.
|
||||||
* @param point
|
|
||||||
*/
|
*/
|
||||||
public static ICPPTemplateArgument[] instantiateArguments(ICPPTemplateArgument[] args,
|
public static ICPPTemplateArgument[] instantiateArguments(ICPPTemplateArgument[] args,
|
||||||
ICPPTemplateParameterMap tpMap, int packOffset, ICPPClassSpecialization within, IASTNode point)
|
ICPPTemplateParameterMap tpMap, int packOffset, ICPPClassSpecialization within, IASTNode point)
|
||||||
|
@ -1072,7 +1069,6 @@ public class CPPTemplates {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates an argument
|
* Instantiates an argument
|
||||||
* @param point
|
|
||||||
*/
|
*/
|
||||||
static ICPPTemplateArgument instantiateArgument(ICPPTemplateArgument arg,
|
static ICPPTemplateArgument instantiateArgument(ICPPTemplateArgument arg,
|
||||||
ICPPTemplateParameterMap tpMap, int packOffset, ICPPClassSpecialization within, IASTNode point) {
|
ICPPTemplateParameterMap tpMap, int packOffset, ICPPClassSpecialization within, IASTNode point) {
|
||||||
|
@ -1120,7 +1116,6 @@ public class CPPTemplates {
|
||||||
/**
|
/**
|
||||||
* Instantiates the given type with the provided map and packОffset.
|
* Instantiates the given type with the provided map and packОffset.
|
||||||
* The context is used to replace templates with their specialization, where appropriate.
|
* The context is used to replace templates with their specialization, where appropriate.
|
||||||
* @param point
|
|
||||||
*/
|
*/
|
||||||
public static IType instantiateType(IType type, ICPPTemplateParameterMap tpMap, int packOffset,
|
public static IType instantiateType(IType type, ICPPTemplateParameterMap tpMap, int packOffset,
|
||||||
ICPPClassSpecialization within, IASTNode point) {
|
ICPPClassSpecialization within, IASTNode point) {
|
||||||
|
@ -1280,8 +1275,8 @@ public class CPPTemplates {
|
||||||
* template <typename T> void MyTemplate<T>::member() {}
|
* template <typename T> void MyTemplate<T>::member() {}
|
||||||
* </pre>
|
* </pre>
|
||||||
* @param name a name for which the corresponding template declaration is searched for.
|
* @param name a name for which the corresponding template declaration is searched for.
|
||||||
* @return the template declaration or <code>null</code> if <code>name</code> does not
|
* @return the template declaration or {@code null} if {@code name} does not correspond
|
||||||
* correspond to a template declaration.
|
* to a template declaration.
|
||||||
*/
|
*/
|
||||||
public static ICPPASTTemplateDeclaration getTemplateDeclaration(IASTName name) {
|
public static ICPPASTTemplateDeclaration getTemplateDeclaration(IASTName name) {
|
||||||
if (name == null)
|
if (name == null)
|
||||||
|
@ -1298,7 +1293,7 @@ public class CPPTemplates {
|
||||||
if (parent instanceof ICPPASTTemplateId) {
|
if (parent instanceof ICPPASTTemplateId) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
// one name: use innermost template declaration
|
// One name: use innermost template declaration
|
||||||
return tdecl;
|
return tdecl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1313,7 +1308,7 @@ public class CPPTemplates {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// not the last name, search for the matching template declaration
|
// Not the last name, search for the matching template declaration
|
||||||
if (!(name instanceof ICPPASTTemplateId))
|
if (!(name instanceof ICPPASTTemplateId))
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
@ -1670,7 +1665,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</code>
|
* The empty ICPPTemplateArgument array is returned if id is {@code null}
|
||||||
*/
|
*/
|
||||||
public static ICPPTemplateArgument[] createTemplateArgumentArray(ICPPASTTemplateId id) {
|
public static ICPPTemplateArgument[] createTemplateArgumentArray(ICPPASTTemplateId id) {
|
||||||
ICPPTemplateArgument[] result= ICPPTemplateArgument.EMPTY_ARGUMENTS;
|
ICPPTemplateArgument[] result= ICPPTemplateArgument.EMPTY_ARGUMENTS;
|
||||||
|
@ -2021,7 +2016,8 @@ public class CPPTemplates {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 14.5.4.1 If none of the specializations is more specialized than all the other matching
|
// 14.5.4.1 If none of the specializations is more specialized than all the other matching
|
||||||
//specializations, then the use of the class template is ambiguous and the program is ill-formed.
|
// specializations, then the use of the class template is ambiguous and the program is
|
||||||
|
// ill-formed.
|
||||||
if (!bestMatchIsBest) {
|
if (!bestMatchIsBest) {
|
||||||
return new CPPTemplateDefinition.CPPTemplateProblem(null, IProblemBinding.SEMANTIC_AMBIGUOUS_LOOKUP, null);
|
return new CPPTemplateDefinition.CPPTemplateProblem(null, IProblemBinding.SEMANTIC_AMBIGUOUS_LOOKUP, null);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue