mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-31 12:55:40 +02:00
Cosmetics.
This commit is contained in:
parent
39c0820517
commit
c532ede4cd
3 changed files with 11 additions and 13 deletions
|
@ -7656,7 +7656,7 @@ public class AST2TemplateTests extends AST2TestBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
// template<typename T>
|
// template<typename T>
|
||||||
// class ATemplate {
|
// class A {
|
||||||
// int defaultMemberVariable;
|
// int defaultMemberVariable;
|
||||||
// public:
|
// public:
|
||||||
// int publicMemberVariable;
|
// int publicMemberVariable;
|
||||||
|
@ -7665,10 +7665,10 @@ public class AST2TemplateTests extends AST2TestBase {
|
||||||
// private:
|
// private:
|
||||||
// int privateMemberVariable;
|
// int privateMemberVariable;
|
||||||
// };
|
// };
|
||||||
public void testTemplateMemberAccessibilities() throws Exception {
|
public void testTemplateMemberAccessibility() throws Exception {
|
||||||
BindingAssertionHelper bh = getAssertionHelper();
|
BindingAssertionHelper bh = getAssertionHelper();
|
||||||
|
|
||||||
ICPPClassTemplate aTemplate = bh.assertNonProblem("ATemplate");
|
ICPPClassTemplate aTemplate = bh.assertNonProblem("A");
|
||||||
|
|
||||||
ICPPField defaultMemberVariable = bh.assertNonProblem("defaultMemberVariable");
|
ICPPField defaultMemberVariable = bh.assertNonProblem("defaultMemberVariable");
|
||||||
assertVisibility(ICPPClassType.v_private, aTemplate.getVisibility(defaultMemberVariable));
|
assertVisibility(ICPPClassType.v_private, aTemplate.getVisibility(defaultMemberVariable));
|
||||||
|
@ -7684,12 +7684,10 @@ public class AST2TemplateTests extends AST2TestBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
// template<typename T>
|
// template<typename T>
|
||||||
// class ATemplate {};
|
// class A {};
|
||||||
//
|
|
||||||
// class A{};
|
|
||||||
//
|
//
|
||||||
// template<>
|
// template<>
|
||||||
// class ATemplate<A> {
|
// class A<int> {
|
||||||
// int specializedDefaultVariable;
|
// int specializedDefaultVariable;
|
||||||
// public:
|
// public:
|
||||||
// int specializedPublicVariable;
|
// int specializedPublicVariable;
|
||||||
|
@ -7698,10 +7696,10 @@ public class AST2TemplateTests extends AST2TestBase {
|
||||||
// private:
|
// private:
|
||||||
// int specializedPrivateVariable;
|
// int specializedPrivateVariable;
|
||||||
// };
|
// };
|
||||||
public void testTemplateSpecializationMemberAccessibilities() throws Exception {
|
public void testTemplateSpecializationMemberAccessibility() throws Exception {
|
||||||
BindingAssertionHelper bh = getAssertionHelper();
|
BindingAssertionHelper bh = getAssertionHelper();
|
||||||
|
|
||||||
ICPPClassSpecialization aTemplateSpecialization = bh.assertNonProblem("ATemplate<A>");
|
ICPPClassSpecialization aTemplateSpecialization = bh.assertNonProblem("A<int>");
|
||||||
|
|
||||||
ICPPField defaultMemberVariable = bh.assertNonProblem("specializedDefaultVariable");
|
ICPPField defaultMemberVariable = bh.assertNonProblem("specializedDefaultVariable");
|
||||||
assertVisibility(ICPPClassType.v_private, aTemplateSpecialization.getVisibility(defaultMemberVariable));
|
assertVisibility(ICPPClassType.v_private, aTemplateSpecialization.getVisibility(defaultMemberVariable));
|
||||||
|
|
|
@ -98,7 +98,7 @@ public class CPPClassInstance extends CPPClassSpecialization implements ICPPTemp
|
||||||
public static boolean isSameClassInstance(ICPPClassSpecialization classInstance, IType type) {
|
public static boolean isSameClassInstance(ICPPClassSpecialization classInstance, IType type) {
|
||||||
assert classInstance instanceof ICPPTemplateInstance;
|
assert classInstance instanceof ICPPTemplateInstance;
|
||||||
|
|
||||||
// require a class instance
|
// Require a class instance.
|
||||||
if (!(type instanceof ICPPClassSpecialization) || !(type instanceof ICPPTemplateInstance) ||
|
if (!(type instanceof ICPPClassSpecialization) || !(type instanceof ICPPTemplateInstance) ||
|
||||||
type instanceof IProblemBinding) {
|
type instanceof IProblemBinding) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -414,7 +414,7 @@ public class CPPClassSpecialization extends CPPSpecialization
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isSameClassSpecialization(ICPPClassSpecialization t1, ICPPClassSpecialization t2) {
|
public static boolean isSameClassSpecialization(ICPPClassSpecialization t1, ICPPClassSpecialization t2) {
|
||||||
// exclude class template specialization or class instance
|
// Exclude class template specialization or class instance.
|
||||||
if (t2 instanceof ICPPTemplateInstance || t2 instanceof ICPPTemplateDefinition ||
|
if (t2 instanceof ICPPTemplateInstance || t2 instanceof ICPPTemplateDefinition ||
|
||||||
t2 instanceof IProblemBinding) {
|
t2 instanceof IProblemBinding) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -426,13 +426,13 @@ public class CPPClassSpecialization extends CPPSpecialization
|
||||||
if (!CharArrayUtils.equals(t1.getNameCharArray(), t2.getNameCharArray()))
|
if (!CharArrayUtils.equals(t1.getNameCharArray(), t2.getNameCharArray()))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// the argument map is not significant for comparing specializations, the map is
|
// The argument map is not significant for comparing specializations, the map is
|
||||||
// determined by the owner of the specialization. This is different for instances,
|
// determined by the owner of the specialization. This is different for instances,
|
||||||
// which have a separate implementation for isSameType().
|
// which have a separate implementation for isSameType().
|
||||||
final IBinding owner1= t1.getOwner();
|
final IBinding owner1= t1.getOwner();
|
||||||
final IBinding owner2= t2.getOwner();
|
final IBinding owner2= t2.getOwner();
|
||||||
|
|
||||||
// for a specialization that is not an instance the owner has to be a class-type
|
// For a specialization that is not an instance the owner has to be a class-type.
|
||||||
if (!(owner1 instanceof ICPPClassType) || !(owner2 instanceof ICPPClassType))
|
if (!(owner1 instanceof ICPPClassType) || !(owner2 instanceof ICPPClassType))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue