mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Cosmetics.
This commit is contained in:
parent
a2f501987d
commit
c67276494e
7 changed files with 1119 additions and 1108 deletions
|
@ -155,7 +155,7 @@ public class AST2TemplateTests extends AST2BaseTest {
|
||||||
ICPPField t2 = (ICPPField) col.getName(5).resolveBinding();
|
ICPPField t2 = (ICPPField) col.getName(5).resolveBinding();
|
||||||
|
|
||||||
assertSame(t1.getType(), T);
|
assertSame(t1.getType(), T);
|
||||||
assertSame(((IPointerType)t2.getType()).getType(), T);
|
assertSame(((IPointerType) t2.getType()).getType(), T);
|
||||||
|
|
||||||
ICPPVariable a = (ICPPVariable) col.getName(9).resolveBinding();
|
ICPPVariable a = (ICPPVariable) col.getName(9).resolveBinding();
|
||||||
|
|
||||||
|
@ -170,20 +170,20 @@ public class AST2TemplateTests extends AST2BaseTest {
|
||||||
|
|
||||||
ICPPField t = (ICPPField) col.getName(11).resolveBinding();
|
ICPPField t = (ICPPField) col.getName(11).resolveBinding();
|
||||||
assertTrue(t instanceof ICPPSpecialization);
|
assertTrue(t instanceof ICPPSpecialization);
|
||||||
assertSame(((ICPPSpecialization)t).getSpecializedBinding(), t1);
|
assertSame(((ICPPSpecialization) t).getSpecializedBinding(), t1);
|
||||||
assertSame(t.getScope(), A_int_Scope);
|
assertSame(t.getScope(), A_int_Scope);
|
||||||
IType type = t.getType();
|
IType type = t.getType();
|
||||||
assertTrue(type instanceof IBasicType);
|
assertTrue(type instanceof IBasicType);
|
||||||
assertEquals(((IBasicType)type).getType(), IBasicType.t_int);
|
assertEquals(((IBasicType) type).getType(), IBasicType.t_int);
|
||||||
|
|
||||||
t = (ICPPField) col.getName(13).resolveBinding();
|
t = (ICPPField) col.getName(13).resolveBinding();
|
||||||
assertTrue(t instanceof ICPPSpecialization);
|
assertTrue(t instanceof ICPPSpecialization);
|
||||||
assertSame(((ICPPSpecialization)t).getSpecializedBinding(), t2);
|
assertSame(((ICPPSpecialization) t).getSpecializedBinding(), t2);
|
||||||
assertSame(t.getScope(), A_int_Scope);
|
assertSame(t.getScope(), A_int_Scope);
|
||||||
type = t.getType();
|
type = t.getType();
|
||||||
assertTrue(type instanceof IPointerType);
|
assertTrue(type instanceof IPointerType);
|
||||||
assertTrue(((IPointerType)type).getType() instanceof IBasicType);
|
assertTrue(((IPointerType) type).getType() instanceof IBasicType);
|
||||||
assertEquals(((IBasicType)((IPointerType)type).getType()).getType(), IBasicType.t_int);
|
assertEquals(((IBasicType) ((IPointerType) type).getType()).getType(), IBasicType.t_int);
|
||||||
}
|
}
|
||||||
|
|
||||||
// template < class T > class A {
|
// template < class T > class A {
|
||||||
|
@ -204,7 +204,7 @@ public class AST2TemplateTests extends AST2BaseTest {
|
||||||
IFunctionType ft = f.getType();
|
IFunctionType ft = f.getType();
|
||||||
|
|
||||||
assertSame(ft.getReturnType(), T);
|
assertSame(ft.getReturnType(), T);
|
||||||
assertSame(((IPointerType)ft.getParameterTypes()[0]).getType(), T);
|
assertSame(((IPointerType) ft.getParameterTypes()[0]).getType(), T);
|
||||||
|
|
||||||
ICPPClassType A_int = (ICPPClassType) col.getName(7).resolveBinding();
|
ICPPClassType A_int = (ICPPClassType) col.getName(7).resolveBinding();
|
||||||
assertTrue(A_int instanceof ICPPTemplateInstance);
|
assertTrue(A_int instanceof ICPPTemplateInstance);
|
||||||
|
@ -212,10 +212,10 @@ public class AST2TemplateTests extends AST2BaseTest {
|
||||||
|
|
||||||
ICPPMethod f_int = (ICPPMethod) col.getName(11).resolveBinding();
|
ICPPMethod f_int = (ICPPMethod) col.getName(11).resolveBinding();
|
||||||
assertTrue(f_int instanceof ICPPSpecialization);
|
assertTrue(f_int instanceof ICPPSpecialization);
|
||||||
assertSame(((ICPPSpecialization)f_int).getSpecializedBinding(), f);
|
assertSame(((ICPPSpecialization) f_int).getSpecializedBinding(), f);
|
||||||
ft = f_int.getType();
|
ft = f_int.getType();
|
||||||
assertTrue(ft.getReturnType() instanceof IBasicType);
|
assertTrue(ft.getReturnType() instanceof IBasicType);
|
||||||
assertTrue(((IPointerType)ft.getParameterTypes()[0]).getType() instanceof IBasicType);
|
assertTrue(((IPointerType) ft.getParameterTypes()[0]).getType() instanceof IBasicType);
|
||||||
}
|
}
|
||||||
|
|
||||||
// template <class T > void f(T);
|
// template <class T > void f(T);
|
||||||
|
@ -246,7 +246,7 @@ public class AST2TemplateTests extends AST2BaseTest {
|
||||||
|
|
||||||
ICPPFunction f3 = (ICPPFunction) col.getName(11).resolveBinding();
|
ICPPFunction f3 = (ICPPFunction) col.getName(11).resolveBinding();
|
||||||
assertTrue(f3 instanceof ICPPTemplateInstance);
|
assertTrue(f3 instanceof ICPPTemplateInstance);
|
||||||
assertSame(((ICPPTemplateInstance)f3).getTemplateDefinition(), f);
|
assertSame(((ICPPTemplateInstance) f3).getTemplateDefinition(), f);
|
||||||
|
|
||||||
assertInstances(col, T, 5);
|
assertInstances(col, T, 5);
|
||||||
}
|
}
|
||||||
|
@ -325,7 +325,7 @@ public class AST2TemplateTests extends AST2BaseTest {
|
||||||
|
|
||||||
// the instantiation of A<T> has to be deferred.
|
// the instantiation of A<T> has to be deferred.
|
||||||
assertInstance(b0, ICPPUnknownBinding.class);
|
assertInstance(b0, ICPPUnknownBinding.class);
|
||||||
final ICPPBinding parent = ((ICPPInternalUnknownScope)b0.getScope()).getScopeBinding();
|
final ICPPBinding parent = ((ICPPInternalUnknownScope) b0.getScope()).getScopeBinding();
|
||||||
assertInstance(parent, ICPPDeferredClassInstance.class);
|
assertInstance(parent, ICPPDeferredClassInstance.class);
|
||||||
assertSame(((ICPPDeferredClassInstance) parent).getSpecializedBinding(), A);
|
assertSame(((ICPPDeferredClassInstance) parent).getSpecializedBinding(), A);
|
||||||
|
|
||||||
|
@ -360,7 +360,7 @@ public class AST2TemplateTests extends AST2BaseTest {
|
||||||
IFunction f2 = (IFunction) col.getName(5).resolveBinding();
|
IFunction f2 = (IFunction) col.getName(5).resolveBinding();
|
||||||
|
|
||||||
assertTrue(f2 instanceof ICPPTemplateInstance);
|
assertTrue(f2 instanceof ICPPTemplateInstance);
|
||||||
assertSame(((ICPPTemplateInstance)f2).getTemplateDefinition(), f1);
|
assertSame(((ICPPTemplateInstance) f2).getTemplateDefinition(), f1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// template < class T > void f(T); // #1
|
// template < class T > void f(T); // #1
|
||||||
|
@ -385,7 +385,7 @@ public class AST2TemplateTests extends AST2BaseTest {
|
||||||
|
|
||||||
IFunction f = (IFunction) col.getName(14).resolveBinding();
|
IFunction f = (IFunction) col.getName(14).resolveBinding();
|
||||||
assertTrue(f instanceof ICPPTemplateInstance);
|
assertTrue(f instanceof ICPPTemplateInstance);
|
||||||
assertSame(((ICPPTemplateInstance)f).getTemplateDefinition(), f3);
|
assertSame(((ICPPTemplateInstance) f).getTemplateDefinition(), f3);
|
||||||
}
|
}
|
||||||
|
|
||||||
// template < class T > void f(T); // #1
|
// template < class T > void f(T); // #1
|
||||||
|
@ -459,11 +459,11 @@ public class AST2TemplateTests extends AST2BaseTest {
|
||||||
|
|
||||||
ICPPVariable a2 = (ICPPVariable) col.getName(15).resolveBinding();
|
ICPPVariable a2 = (ICPPVariable) col.getName(15).resolveBinding();
|
||||||
assertTrue(a2 instanceof ICPPSpecialization);
|
assertTrue(a2 instanceof ICPPSpecialization);
|
||||||
assertSame(((ICPPSpecialization)a2).getSpecializedBinding(), a);
|
assertSame(((ICPPSpecialization) a2).getSpecializedBinding(), a);
|
||||||
IType at = a2.getType();
|
IType at = a2.getType();
|
||||||
assertTrue(at instanceof IPointerType);
|
assertTrue(at instanceof IPointerType);
|
||||||
|
|
||||||
assertSame(((IPointerType)at).getType(), ((IPointerType)bt).getType());
|
assertSame(((IPointerType) at).getType(), ((IPointerType) bt).getType());
|
||||||
}
|
}
|
||||||
|
|
||||||
// template < class T1, class T2, int I > class A {}; //#1
|
// template < class T1, class T2, int I > class A {}; //#1
|
||||||
|
@ -546,7 +546,7 @@ public class AST2TemplateTests extends AST2BaseTest {
|
||||||
|
|
||||||
ICPPFunction ref = (ICPPFunction) col.getName(6).resolveBinding();
|
ICPPFunction ref = (ICPPFunction) col.getName(6).resolveBinding();
|
||||||
assertTrue(ref instanceof ICPPTemplateInstance);
|
assertTrue(ref instanceof ICPPTemplateInstance);
|
||||||
assertSame(((ICPPTemplateInstance)ref).getTemplateDefinition(), f);
|
assertSame(((ICPPTemplateInstance) ref).getTemplateDefinition(), f);
|
||||||
}
|
}
|
||||||
|
|
||||||
// template<class T> void f(T);
|
// template<class T> void f(T);
|
||||||
|
@ -560,7 +560,7 @@ public class AST2TemplateTests extends AST2BaseTest {
|
||||||
|
|
||||||
ICPPFunction ref = (ICPPFunction) col.getName(6).resolveBinding();
|
ICPPFunction ref = (ICPPFunction) col.getName(6).resolveBinding();
|
||||||
assertTrue(ref instanceof ICPPTemplateInstance);
|
assertTrue(ref instanceof ICPPTemplateInstance);
|
||||||
assertSame(((ICPPTemplateInstance)ref).getTemplateDefinition(), f);
|
assertSame(((ICPPTemplateInstance) ref).getTemplateDefinition(), f);
|
||||||
}
|
}
|
||||||
|
|
||||||
// template<class X, class Y> X f(Y);
|
// template<class X, class Y> X f(Y);
|
||||||
|
@ -591,7 +591,7 @@ public class AST2TemplateTests extends AST2BaseTest {
|
||||||
ICPPFunctionTemplate f = (ICPPFunctionTemplate) col.getName(1).resolveBinding();
|
ICPPFunctionTemplate f = (ICPPFunctionTemplate) col.getName(1).resolveBinding();
|
||||||
ICPPFunction ref = (ICPPFunction) col.getName(5).resolveBinding();
|
ICPPFunction ref = (ICPPFunction) col.getName(5).resolveBinding();
|
||||||
assertTrue(ref instanceof ICPPTemplateInstance);
|
assertTrue(ref instanceof ICPPTemplateInstance);
|
||||||
assertSame(((ICPPTemplateInstance)ref).getTemplateDefinition(), f);
|
assertSame(((ICPPTemplateInstance) ref).getTemplateDefinition(), f);
|
||||||
}
|
}
|
||||||
|
|
||||||
// template<class T> void f(T); // #1
|
// template<class T> void f(T); // #1
|
||||||
|
@ -640,7 +640,7 @@ public class AST2TemplateTests extends AST2BaseTest {
|
||||||
ICPPClassType x2 = (ICPPClassType) col.getName(4).resolveBinding();
|
ICPPClassType x2 = (ICPPClassType) col.getName(4).resolveBinding();
|
||||||
|
|
||||||
assertTrue(x1 instanceof ICPPTemplateInstance);
|
assertTrue(x1 instanceof ICPPTemplateInstance);
|
||||||
assertSame(((ICPPTemplateInstance)x1).getTemplateDefinition(), X);
|
assertSame(((ICPPTemplateInstance) x1).getTemplateDefinition(), X);
|
||||||
|
|
||||||
assertSame(x1, x2);
|
assertSame(x1, x2);
|
||||||
}
|
}
|
||||||
|
@ -663,19 +663,19 @@ public class AST2TemplateTests extends AST2BaseTest {
|
||||||
|
|
||||||
assertNotSame(f1, f2);
|
assertNotSame(f1, f2);
|
||||||
assertTrue(f1 instanceof ICPPTemplateInstance);
|
assertTrue(f1 instanceof ICPPTemplateInstance);
|
||||||
assertSame(((ICPPTemplateInstance)f1).getTemplateDefinition(), f);
|
assertSame(((ICPPTemplateInstance) f1).getTemplateDefinition(), f);
|
||||||
assertTrue(f2 instanceof ICPPTemplateInstance);
|
assertTrue(f2 instanceof ICPPTemplateInstance);
|
||||||
assertSame(((ICPPTemplateInstance)f2).getTemplateDefinition(), f);
|
assertSame(((ICPPTemplateInstance) f2).getTemplateDefinition(), f);
|
||||||
|
|
||||||
IType fr1 = f1.getType().getReturnType();
|
IType fr1 = f1.getType().getReturnType();
|
||||||
IType fr2 = f2.getType().getReturnType();
|
IType fr2 = f2.getType().getReturnType();
|
||||||
|
|
||||||
assertTrue(fr1 instanceof IBasicType);
|
assertTrue(fr1 instanceof IBasicType);
|
||||||
assertEquals(((IBasicType)fr1).getType(), IBasicType.t_int);
|
assertEquals(((IBasicType) fr1).getType(), IBasicType.t_int);
|
||||||
|
|
||||||
assertTrue(fr2 instanceof IPointerType);
|
assertTrue(fr2 instanceof IPointerType);
|
||||||
assertTrue(((IPointerType)fr2).getType() instanceof IBasicType);
|
assertTrue(((IPointerType) fr2).getType() instanceof IBasicType);
|
||||||
assertEquals(((IBasicType) ((IPointerType)fr2).getType()).getType(), IBasicType.t_char);
|
assertEquals(((IBasicType) ((IPointerType) fr2).getType()).getType(), IBasicType.t_char);
|
||||||
}
|
}
|
||||||
|
|
||||||
// template<class T> void f(T) { }
|
// template<class T> void f(T) { }
|
||||||
|
@ -696,10 +696,10 @@ public class AST2TemplateTests extends AST2BaseTest {
|
||||||
assertSame(f2.getSpecializedBinding(), f1);
|
assertSame(f2.getSpecializedBinding(), f1);
|
||||||
assertSame(g2.getSpecializedBinding(), g1);
|
assertSame(g2.getSpecializedBinding(), g1);
|
||||||
|
|
||||||
assertFalse(((ICPPFunction)f1).isInline());
|
assertFalse(((ICPPFunction) f1).isInline());
|
||||||
assertTrue(((ICPPFunction)g1).isInline());
|
assertTrue(((ICPPFunction) g1).isInline());
|
||||||
assertTrue(((ICPPFunction)f2).isInline());
|
assertTrue(((ICPPFunction) f2).isInline());
|
||||||
assertFalse(((ICPPFunction)g2).isInline());
|
assertFalse(((ICPPFunction) g2).isInline());
|
||||||
}
|
}
|
||||||
|
|
||||||
// template<class T> class X {
|
// template<class T> class X {
|
||||||
|
@ -732,10 +732,10 @@ public class AST2TemplateTests extends AST2BaseTest {
|
||||||
assertTrue(a2 instanceof ICPPSpecialization);
|
assertTrue(a2 instanceof ICPPSpecialization);
|
||||||
assertTrue(a3 instanceof ICPPSpecialization);
|
assertTrue(a3 instanceof ICPPSpecialization);
|
||||||
assertTrue(a4 instanceof ICPPSpecialization);
|
assertTrue(a4 instanceof ICPPSpecialization);
|
||||||
assertSame(((ICPPSpecialization)a1).getSpecializedBinding(), a);
|
assertSame(((ICPPSpecialization) a1).getSpecializedBinding(), a);
|
||||||
assertSame(((ICPPSpecialization)a2).getSpecializedBinding(), a);
|
assertSame(((ICPPSpecialization) a2).getSpecializedBinding(), a);
|
||||||
assertSame(((ICPPSpecialization)a3).getSpecializedBinding(), a);
|
assertSame(((ICPPSpecialization) a3).getSpecializedBinding(), a);
|
||||||
assertSame(((ICPPSpecialization)a4).getSpecializedBinding(), a);
|
assertSame(((ICPPSpecialization) a4).getSpecializedBinding(), a);
|
||||||
}
|
}
|
||||||
|
|
||||||
// template<class T> class Y;
|
// template<class T> class Y;
|
||||||
|
@ -759,7 +759,7 @@ public class AST2TemplateTests extends AST2BaseTest {
|
||||||
|
|
||||||
ICPPClassType y2 = (ICPPClassType) col.getName(6).resolveBinding();
|
ICPPClassType y2 = (ICPPClassType) col.getName(6).resolveBinding();
|
||||||
assertTrue(y2 instanceof ICPPTemplateInstance);
|
assertTrue(y2 instanceof ICPPTemplateInstance);
|
||||||
assertSame(((ICPPTemplateInstance)y2).getTemplateDefinition(), Y);
|
assertSame(((ICPPTemplateInstance) y2).getTemplateDefinition(), Y);
|
||||||
}
|
}
|
||||||
|
|
||||||
// template < class T, class U > void f (T (*) (T, U));
|
// template < class T, class U > void f (T (*) (T, U));
|
||||||
|
@ -779,7 +779,7 @@ public class AST2TemplateTests extends AST2BaseTest {
|
||||||
IBinding g2 = col.getName(14).resolveBinding();
|
IBinding g2 = col.getName(14).resolveBinding();
|
||||||
|
|
||||||
assertTrue(f2 instanceof ICPPTemplateInstance);
|
assertTrue(f2 instanceof ICPPTemplateInstance);
|
||||||
assertSame(((ICPPTemplateInstance)f2).getTemplateDefinition(), f1);
|
assertSame(((ICPPTemplateInstance) f2).getTemplateDefinition(), f1);
|
||||||
assertSame(g1, g2);
|
assertSame(g1, g2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -809,11 +809,11 @@ public class AST2TemplateTests extends AST2BaseTest {
|
||||||
|
|
||||||
ICPPField u2 = (ICPPField) col.getName(11).resolveBinding();
|
ICPPField u2 = (ICPPField) col.getName(11).resolveBinding();
|
||||||
assertTrue(u2 instanceof ICPPSpecialization);
|
assertTrue(u2 instanceof ICPPSpecialization);
|
||||||
assertSame(((ICPPSpecialization)u2).getSpecializedBinding(), u1);
|
assertSame(((ICPPSpecialization) u2).getSpecializedBinding(), u1);
|
||||||
|
|
||||||
IType type = u2.getType();
|
IType type = u2.getType();
|
||||||
assertTrue(type instanceof IBasicType);
|
assertTrue(type instanceof IBasicType);
|
||||||
assertEquals(((IBasicType)type).getType(), IBasicType.t_int);
|
assertEquals(((IBasicType) type).getType(), IBasicType.t_int);
|
||||||
}
|
}
|
||||||
|
|
||||||
// template < class T > class A {
|
// template < class T > class A {
|
||||||
|
@ -878,18 +878,18 @@ public class AST2TemplateTests extends AST2BaseTest {
|
||||||
ICPPField pA2 = (ICPPField) col.getName(17).resolveBinding();
|
ICPPField pA2 = (ICPPField) col.getName(17).resolveBinding();
|
||||||
|
|
||||||
assertTrue(f2 instanceof ICPPSpecialization);
|
assertTrue(f2 instanceof ICPPSpecialization);
|
||||||
assertSame(((ICPPSpecialization)f2).getSpecializedBinding(), f);
|
assertSame(((ICPPSpecialization) f2).getSpecializedBinding(), f);
|
||||||
assertTrue(pA2 instanceof ICPPSpecialization);
|
assertTrue(pA2 instanceof ICPPSpecialization);
|
||||||
assertSame(((ICPPSpecialization)pA2).getSpecializedBinding(), pA);
|
assertSame(((ICPPSpecialization) pA2).getSpecializedBinding(), pA);
|
||||||
|
|
||||||
IType paT = pA2.getType();
|
IType paT = pA2.getType();
|
||||||
assertTrue(paT instanceof IPointerType);
|
assertTrue(paT instanceof IPointerType);
|
||||||
assertSame(((IPointerType)paT).getType(), AI);
|
assertSame(((IPointerType) paT).getType(), AI);
|
||||||
|
|
||||||
IParameter p = f2.getParameters()[0];
|
IParameter p = f2.getParameters()[0];
|
||||||
IType pT = p.getType();
|
IType pT = p.getType();
|
||||||
assertTrue(pT instanceof IPointerType);
|
assertTrue(pT instanceof IPointerType);
|
||||||
assertSame(((IPointerType)pT).getType(), AI);
|
assertSame(((IPointerType) pT).getType(), AI);
|
||||||
}
|
}
|
||||||
|
|
||||||
// template <class T> struct A {
|
// template <class T> struct A {
|
||||||
|
@ -916,7 +916,7 @@ public class AST2TemplateTests extends AST2BaseTest {
|
||||||
ICPPMethod f1_2 = (ICPPMethod) col.getName(11).resolveBinding();
|
ICPPMethod f1_2 = (ICPPMethod) col.getName(11).resolveBinding();
|
||||||
assertNotSame(f1, f1_2);
|
assertNotSame(f1, f1_2);
|
||||||
assertTrue(f1_2 instanceof ICPPSpecialization);
|
assertTrue(f1_2 instanceof ICPPSpecialization);
|
||||||
assertSame(((ICPPSpecialization)f1_2).getSpecializedBinding(), f1);
|
assertSame(((ICPPSpecialization) f1_2).getSpecializedBinding(), f1);
|
||||||
|
|
||||||
ICPPClassType A2 = (ICPPClassType) col.getName(9).resolveBinding();
|
ICPPClassType A2 = (ICPPClassType) col.getName(9).resolveBinding();
|
||||||
assertTrue(A2 instanceof ICPPTemplateInstance);
|
assertTrue(A2 instanceof ICPPTemplateInstance);
|
||||||
|
@ -924,9 +924,9 @@ public class AST2TemplateTests extends AST2BaseTest {
|
||||||
|
|
||||||
ICPPMethod f2_2 = (ICPPMethod) col.getName(16).resolveBinding();
|
ICPPMethod f2_2 = (ICPPMethod) col.getName(16).resolveBinding();
|
||||||
assertTrue(f2_2 instanceof ICPPSpecialization);
|
assertTrue(f2_2 instanceof ICPPSpecialization);
|
||||||
IBinding speced = ((ICPPSpecialization)f2_2).getSpecializedBinding();
|
IBinding speced = ((ICPPSpecialization) f2_2).getSpecializedBinding();
|
||||||
assertTrue(speced instanceof ICPPFunctionTemplate && speced instanceof ICPPSpecialization);
|
assertTrue(speced instanceof ICPPFunctionTemplate && speced instanceof ICPPSpecialization);
|
||||||
assertSame(((ICPPSpecialization)speced).getSpecializedBinding(), f2);
|
assertSame(((ICPPSpecialization) speced).getSpecializedBinding(), f2);
|
||||||
|
|
||||||
ICPPClassType A3 = (ICPPClassType) col.getName(14).resolveBinding();
|
ICPPClassType A3 = (ICPPClassType) col.getName(14).resolveBinding();
|
||||||
assertSame(A2, A3);
|
assertSame(A2, A3);
|
||||||
|
@ -940,7 +940,7 @@ public class AST2TemplateTests extends AST2BaseTest {
|
||||||
|
|
||||||
assertSame(r1, f1_2);
|
assertSame(r1, f1_2);
|
||||||
assertTrue(r2 instanceof ICPPTemplateInstance);
|
assertTrue(r2 instanceof ICPPTemplateInstance);
|
||||||
assertSame(((ICPPTemplateInstance)r2).getTemplateDefinition(), speced);
|
assertSame(((ICPPTemplateInstance) r2).getTemplateDefinition(), speced);
|
||||||
assertSame(r3, f2_2);
|
assertSame(r3, f2_2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -963,7 +963,7 @@ public class AST2TemplateTests extends AST2BaseTest {
|
||||||
ICPPClassType r2 = (ICPPClassType) col.getName(7).resolveBinding();
|
ICPPClassType r2 = (ICPPClassType) col.getName(7).resolveBinding();
|
||||||
|
|
||||||
assertTrue(r1 instanceof ICPPTemplateInstance);
|
assertTrue(r1 instanceof ICPPTemplateInstance);
|
||||||
assertSame(((ICPPTemplateInstance)r1).getTemplateDefinition(), A1);
|
assertSame(((ICPPTemplateInstance) r1).getTemplateDefinition(), A1);
|
||||||
assertSame(r2, A2);
|
assertSame(r2, A2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1039,14 +1039,14 @@ public class AST2TemplateTests extends AST2BaseTest {
|
||||||
|
|
||||||
ICPPMethod f1 = (ICPPMethod) col.getName(20).resolveBinding();
|
ICPPMethod f1 = (ICPPMethod) col.getName(20).resolveBinding();
|
||||||
assertTrue(f1 instanceof ICPPSpecialization);
|
assertTrue(f1 instanceof ICPPSpecialization);
|
||||||
assertTrue(((ICPPSpecialization)f1).getSpecializedBinding() instanceof ICPPMethod);
|
assertTrue(((ICPPSpecialization) f1).getSpecializedBinding() instanceof ICPPMethod);
|
||||||
ICPPMethod f2 = (ICPPMethod) ((ICPPSpecialization)f1).getSpecializedBinding();
|
ICPPMethod f2 = (ICPPMethod) ((ICPPSpecialization) f1).getSpecializedBinding();
|
||||||
assertTrue(f2 instanceof ICPPSpecialization);
|
assertTrue(f2 instanceof ICPPSpecialization);
|
||||||
assertSame(((ICPPSpecialization)f2).getSpecializedBinding(), f);
|
assertSame(((ICPPSpecialization) f2).getSpecializedBinding(), f);
|
||||||
|
|
||||||
IFunctionType ft = f1.getType();
|
IFunctionType ft = f1.getType();
|
||||||
assertTrue(ft.getReturnType() instanceof IBasicType);
|
assertTrue(ft.getReturnType() instanceof IBasicType);
|
||||||
assertEquals(((IBasicType)ft.getReturnType()).getType(), IBasicType.t_int);
|
assertEquals(((IBasicType) ft.getReturnType()).getType(), IBasicType.t_int);
|
||||||
|
|
||||||
assertSame(ft.getParameterTypes()[0], C);
|
assertSame(ft.getParameterTypes()[0], C);
|
||||||
}
|
}
|
||||||
|
@ -1109,23 +1109,23 @@ public class AST2TemplateTests extends AST2BaseTest {
|
||||||
|
|
||||||
ICPPField y2 = (ICPPField) col.getName(23).resolveBinding();
|
ICPPField y2 = (ICPPField) col.getName(23).resolveBinding();
|
||||||
assertTrue(y2 instanceof ICPPSpecialization);
|
assertTrue(y2 instanceof ICPPSpecialization);
|
||||||
assertSame(((ICPPSpecialization)y2).getSpecializedBinding(), y);
|
assertSame(((ICPPSpecialization) y2).getSpecializedBinding(), y);
|
||||||
IType t = y2.getType();
|
IType t = y2.getType();
|
||||||
assertTrue(t instanceof ICPPTemplateInstance);
|
assertTrue(t instanceof ICPPTemplateInstance);
|
||||||
assertSame(((ICPPTemplateInstance)t).getTemplateDefinition(), A1);
|
assertSame(((ICPPTemplateInstance) t).getTemplateDefinition(), A1);
|
||||||
ICPPField x3 = (ICPPField) col.getName(24).resolveBinding();
|
ICPPField x3 = (ICPPField) col.getName(24).resolveBinding();
|
||||||
assertTrue(x3 instanceof ICPPSpecialization);
|
assertTrue(x3 instanceof ICPPSpecialization);
|
||||||
assertEquals(((ICPPSpecialization)x3).getSpecializedBinding(), x1);
|
assertEquals(((ICPPSpecialization) x3).getSpecializedBinding(), x1);
|
||||||
|
|
||||||
ICPPField z2 = (ICPPField) col.getName(26).resolveBinding();
|
ICPPField z2 = (ICPPField) col.getName(26).resolveBinding();
|
||||||
assertTrue(z2 instanceof ICPPSpecialization);
|
assertTrue(z2 instanceof ICPPSpecialization);
|
||||||
assertSame(((ICPPSpecialization)z2).getSpecializedBinding(), z);
|
assertSame(((ICPPSpecialization) z2).getSpecializedBinding(), z);
|
||||||
t = z2.getType();
|
t = z2.getType();
|
||||||
assertTrue(t instanceof ICPPTemplateInstance);
|
assertTrue(t instanceof ICPPTemplateInstance);
|
||||||
assertSame(((ICPPTemplateInstance)t).getTemplateDefinition(), A2);
|
assertSame(((ICPPTemplateInstance) t).getTemplateDefinition(), A2);
|
||||||
ICPPField x4 = (ICPPField) col.getName(27).resolveBinding();
|
ICPPField x4 = (ICPPField) col.getName(27).resolveBinding();
|
||||||
assertTrue(x4 instanceof ICPPSpecialization);
|
assertTrue(x4 instanceof ICPPSpecialization);
|
||||||
assertEquals(((ICPPSpecialization)x4).getSpecializedBinding(), x2);
|
assertEquals(((ICPPSpecialization) x4).getSpecializedBinding(), x2);
|
||||||
}
|
}
|
||||||
|
|
||||||
// template <class T> class A {
|
// template <class T> class A {
|
||||||
|
@ -1150,16 +1150,16 @@ public class AST2TemplateTests extends AST2BaseTest {
|
||||||
|
|
||||||
ICPPField t2 = (ICPPField) col.getName(11).resolveBinding();
|
ICPPField t2 = (ICPPField) col.getName(11).resolveBinding();
|
||||||
assertTrue(t2 instanceof ICPPSpecialization);
|
assertTrue(t2 instanceof ICPPSpecialization);
|
||||||
assertSame(((ICPPSpecialization)t2).getSpecializedBinding(), t);
|
assertSame(((ICPPSpecialization) t2).getSpecializedBinding(), t);
|
||||||
|
|
||||||
IType type = t2.getType();
|
IType type = t2.getType();
|
||||||
assertTrue(type instanceof ITypedef);
|
assertTrue(type instanceof ITypedef);
|
||||||
assertTrue(type instanceof ICPPSpecialization);
|
assertTrue(type instanceof ICPPSpecialization);
|
||||||
assertSame(((ICPPSpecialization)type).getSpecializedBinding(), _T);
|
assertSame(((ICPPSpecialization) type).getSpecializedBinding(), _T);
|
||||||
|
|
||||||
type = ((ITypedef)type).getType();
|
type = ((ITypedef) type).getType();
|
||||||
assertTrue(type instanceof IBasicType);
|
assertTrue(type instanceof IBasicType);
|
||||||
assertEquals(((IBasicType)type).getType(), IBasicType.t_int);
|
assertEquals(((IBasicType) type).getType(), IBasicType.t_int);
|
||||||
}
|
}
|
||||||
|
|
||||||
// template <class T> class A {
|
// template <class T> class A {
|
||||||
|
@ -1186,16 +1186,16 @@ public class AST2TemplateTests extends AST2BaseTest {
|
||||||
ICPPField t2 = (ICPPField) col.getName(13).resolveBinding();
|
ICPPField t2 = (ICPPField) col.getName(13).resolveBinding();
|
||||||
|
|
||||||
assertTrue(b2 instanceof ICPPSpecialization);
|
assertTrue(b2 instanceof ICPPSpecialization);
|
||||||
assertSame(((ICPPSpecialization)b2).getSpecializedBinding(), b);
|
assertSame(((ICPPSpecialization) b2).getSpecializedBinding(), b);
|
||||||
|
|
||||||
IType type = b2.getType();
|
IType type = b2.getType();
|
||||||
assertTrue(type instanceof ICPPSpecialization);
|
assertTrue(type instanceof ICPPSpecialization);
|
||||||
assertSame(((ICPPSpecialization)type).getSpecializedBinding(), B);
|
assertSame(((ICPPSpecialization) type).getSpecializedBinding(), B);
|
||||||
|
|
||||||
assertTrue(t2 instanceof ICPPSpecialization);
|
assertTrue(t2 instanceof ICPPSpecialization);
|
||||||
assertSame(((ICPPSpecialization)t2).getSpecializedBinding(), t);
|
assertSame(((ICPPSpecialization) t2).getSpecializedBinding(), t);
|
||||||
assertTrue(t2.getType() instanceof IBasicType);
|
assertTrue(t2.getType() instanceof IBasicType);
|
||||||
assertEquals(((IBasicType)t2.getType()).getType(), IBasicType.t_int);
|
assertEquals(((IBasicType) t2.getType()).getType(), IBasicType.t_int);
|
||||||
}
|
}
|
||||||
|
|
||||||
// template <class T> class A {
|
// template <class T> class A {
|
||||||
|
@ -1239,18 +1239,18 @@ public class AST2TemplateTests extends AST2BaseTest {
|
||||||
|
|
||||||
ICPPField s2 = (ICPPField) col.getName(21).resolveBinding();
|
ICPPField s2 = (ICPPField) col.getName(21).resolveBinding();
|
||||||
assertTrue(s2 instanceof ICPPSpecialization);
|
assertTrue(s2 instanceof ICPPSpecialization);
|
||||||
assertSame(((ICPPSpecialization)s2).getSpecializedBinding(), s);
|
assertSame(((ICPPSpecialization) s2).getSpecializedBinding(), s);
|
||||||
|
|
||||||
IType t = s2.getType();
|
IType t = s2.getType();
|
||||||
// assertTrue(t instanceof ITypedef);
|
// assertTrue(t instanceof ITypedef);
|
||||||
// assertTrue(t instanceof ICPPSpecialization);
|
// assertTrue(t instanceof ICPPSpecialization);
|
||||||
// assertSame(((ICPPSpecialization)t).getSpecializedBinding(), _xx);
|
// assertSame(((ICPPSpecialization) t).getSpecializedBinding(), _xx);
|
||||||
|
|
||||||
t = ((ITypedef)t).getType();
|
t = ((ITypedef) t).getType();
|
||||||
assertTrue(t instanceof ICPPSpecialization);
|
assertTrue(t instanceof ICPPSpecialization);
|
||||||
assertSame(((ICPPSpecialization)t).getSpecializedBinding(), X2);
|
assertSame(((ICPPSpecialization) t).getSpecializedBinding(), X2);
|
||||||
|
|
||||||
t = ((ITypedef)t).getType();
|
t = ((ITypedef) t).getType();
|
||||||
assertSame(t, B);
|
assertSame(t, B);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1469,7 +1469,7 @@ public class AST2TemplateTests extends AST2BaseTest {
|
||||||
assertSame(((ICPPTemplateInstance)A2).getTemplateDefinition(), A);
|
assertSame(((ICPPTemplateInstance)A2).getTemplateDefinition(), A);
|
||||||
ICPPMethod f2 = (ICPPMethod) col.getName(17).resolveBinding();
|
ICPPMethod f2 = (ICPPMethod) col.getName(17).resolveBinding();
|
||||||
assertTrue(f2 instanceof ICPPSpecialization);
|
assertTrue(f2 instanceof ICPPSpecialization);
|
||||||
assertSame(((ICPPSpecialization)f2).getSpecializedBinding(), f);
|
assertSame(((ICPPSpecialization) f2).getSpecializedBinding(), f);
|
||||||
|
|
||||||
ICPPTemplateParameter TR = (ICPPTemplateParameter) col.getName(19).resolveBinding();
|
ICPPTemplateParameter TR = (ICPPTemplateParameter) col.getName(19).resolveBinding();
|
||||||
assertSame(T, TR);
|
assertSame(T, TR);
|
||||||
|
@ -1492,7 +1492,7 @@ public class AST2TemplateTests extends AST2BaseTest {
|
||||||
|
|
||||||
ICPPMethod h2 = (ICPPMethod) col.getName(54).resolveBinding();
|
ICPPMethod h2 = (ICPPMethod) col.getName(54).resolveBinding();
|
||||||
assertTrue(h2 instanceof ICPPSpecialization);
|
assertTrue(h2 instanceof ICPPSpecialization);
|
||||||
assertSame(((ICPPSpecialization)h2).getSpecializedBinding(), h);
|
assertSame(((ICPPSpecialization) h2).getSpecializedBinding(), h);
|
||||||
}
|
}
|
||||||
|
|
||||||
// namespace N {
|
// namespace N {
|
||||||
|
@ -1551,7 +1551,7 @@ public class AST2TemplateTests extends AST2BaseTest {
|
||||||
|
|
||||||
ICPPFunction s2 = (ICPPFunction) col.getName(8).resolveBinding();
|
ICPPFunction s2 = (ICPPFunction) col.getName(8).resolveBinding();
|
||||||
assertTrue(s2 instanceof ICPPTemplateInstance);
|
assertTrue(s2 instanceof ICPPTemplateInstance);
|
||||||
assertSame(((ICPPTemplateInstance)s2).getTemplateDefinition(), s);
|
assertSame(((ICPPTemplateInstance) s2).getTemplateDefinition(), s);
|
||||||
|
|
||||||
ICPPClassType A3 = (ICPPClassType) col.getName(10).resolveBinding();
|
ICPPClassType A3 = (ICPPClassType) col.getName(10).resolveBinding();
|
||||||
assertTrue(A3 instanceof ICPPTemplateInstance);
|
assertTrue(A3 instanceof ICPPTemplateInstance);
|
||||||
|
@ -1576,7 +1576,7 @@ public class AST2TemplateTests extends AST2BaseTest {
|
||||||
ICPPFunctionTemplate s1 = (ICPPFunctionTemplate) col.getName(5).resolveBinding();
|
ICPPFunctionTemplate s1 = (ICPPFunctionTemplate) col.getName(5).resolveBinding();
|
||||||
ICPPFunction s2 = (ICPPFunction) col.getName(10).resolveBinding();
|
ICPPFunction s2 = (ICPPFunction) col.getName(10).resolveBinding();
|
||||||
assertTrue(s2 instanceof ICPPTemplateInstance);
|
assertTrue(s2 instanceof ICPPTemplateInstance);
|
||||||
assertSame(((ICPPTemplateInstance)s2).getTemplateDefinition(), s1);
|
assertSame(((ICPPTemplateInstance) s2).getTemplateDefinition(), s1);
|
||||||
|
|
||||||
ICPPClassType A3 = (ICPPClassType) col.getName(11).resolveBinding();
|
ICPPClassType A3 = (ICPPClassType) col.getName(11).resolveBinding();
|
||||||
assertSame(A2, A3);
|
assertSame(A2, A3);
|
||||||
|
@ -1595,7 +1595,7 @@ public class AST2TemplateTests extends AST2BaseTest {
|
||||||
|
|
||||||
IASTName f = col.getName(6);
|
IASTName f = col.getName(6);
|
||||||
IASTFunctionDefinition fdef = (IASTFunctionDefinition) f.getParent().getParent();
|
IASTFunctionDefinition fdef = (IASTFunctionDefinition) f.getParent().getParent();
|
||||||
IASTExpressionStatement statement = (IASTExpressionStatement) ((IASTCompoundStatement)fdef.getBody()).getStatements()[0];
|
IASTExpressionStatement statement = (IASTExpressionStatement) ((IASTCompoundStatement) fdef.getBody()).getStatements()[0];
|
||||||
IType type = statement.getExpression().getExpressionType();
|
IType type = statement.getExpression().getExpressionType();
|
||||||
|
|
||||||
assertTrue(type.isSameType(p.getType()));
|
assertTrue(type.isSameType(p.getType()));
|
||||||
|
@ -1662,11 +1662,11 @@ public class AST2TemplateTests extends AST2BaseTest {
|
||||||
|
|
||||||
IBinding r = col.getName(33).resolveBinding();
|
IBinding r = col.getName(33).resolveBinding();
|
||||||
assertTrue(r instanceof ICPPSpecialization);
|
assertTrue(r instanceof ICPPSpecialization);
|
||||||
assertSame(((ICPPSpecialization)r).getSpecializedBinding(), begin);
|
assertSame(((ICPPSpecialization) r).getSpecializedBinding(), begin);
|
||||||
|
|
||||||
r = col.getName(36).resolveBinding();
|
r = col.getName(36).resolveBinding();
|
||||||
assertTrue(r instanceof ICPPSpecialization);
|
assertTrue(r instanceof ICPPSpecialization);
|
||||||
assertSame(((ICPPSpecialization)r).getSpecializedBinding(), end);
|
assertSame(((ICPPSpecialization) r).getSpecializedBinding(), end);
|
||||||
|
|
||||||
assertSame(foo, col.getName(39).resolveBinding());
|
assertSame(foo, col.getName(39).resolveBinding());
|
||||||
assertSame(foo, col.getName(41).resolveBinding());
|
assertSame(foo, col.getName(41).resolveBinding());
|
||||||
|
@ -1692,8 +1692,8 @@ public class AST2TemplateTests extends AST2BaseTest {
|
||||||
|
|
||||||
IType type = t.getType();
|
IType type = t.getType();
|
||||||
assertTrue(type instanceof ICPPSpecialization);
|
assertTrue(type instanceof ICPPSpecialization);
|
||||||
assertSame(((ICPPSpecialization)type).getSpecializedBinding(), _T);
|
assertSame(((ICPPSpecialization) type).getSpecializedBinding(), _T);
|
||||||
assertSame(((IPointerType)((ITypedef)type).getType()).getType(), B);
|
assertSame(((IPointerType) ((ITypedef) type).getType()).getType(), B);
|
||||||
assertSame(i, col.getName(14).resolveBinding());
|
assertSame(i, col.getName(14).resolveBinding());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1858,7 +1858,7 @@ public class AST2TemplateTests extends AST2BaseTest {
|
||||||
|
|
||||||
IBinding b = col.getName(9).resolveBinding(); // resolve the binding of the ICPPASTTemplateId first
|
IBinding b = col.getName(9).resolveBinding(); // resolve the binding of the ICPPASTTemplateId first
|
||||||
assertTrue(b instanceof ICPPTemplateInstance);
|
assertTrue(b instanceof ICPPTemplateInstance);
|
||||||
assertSame(((ICPPTemplateInstance)b).getSpecializedBinding(), f1);
|
assertSame(((ICPPTemplateInstance) b).getSpecializedBinding(), f1);
|
||||||
assertSame(f1, col.getName(10).resolveBinding());
|
assertSame(f1, col.getName(10).resolveBinding());
|
||||||
|
|
||||||
|
|
||||||
|
@ -1885,7 +1885,7 @@ public class AST2TemplateTests extends AST2BaseTest {
|
||||||
|
|
||||||
ICPPClassType a = (ICPPClassType) col.getName(5).resolveBinding();
|
ICPPClassType a = (ICPPClassType) col.getName(5).resolveBinding();
|
||||||
assertTrue(a instanceof ICPPTemplateInstance);
|
assertTrue(a instanceof ICPPTemplateInstance);
|
||||||
assertSame(((ICPPTemplateInstance)a).getTemplateDefinition(), A);
|
assertSame(((ICPPTemplateInstance) a).getTemplateDefinition(), A);
|
||||||
assertSame(local, col.getName(7).resolveBinding());
|
assertSame(local, col.getName(7).resolveBinding());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1928,7 +1928,7 @@ public class AST2TemplateTests extends AST2BaseTest {
|
||||||
ICPPClassTemplate complex = (ICPPClassTemplate) col.getName(1).resolveBinding();
|
ICPPClassTemplate complex = (ICPPClassTemplate) col.getName(1).resolveBinding();
|
||||||
ICPPClassType cspec = (ICPPClassType) col.getName(2).resolveBinding();
|
ICPPClassType cspec = (ICPPClassType) col.getName(2).resolveBinding();
|
||||||
assertTrue(cspec instanceof ICPPSpecialization);
|
assertTrue(cspec instanceof ICPPSpecialization);
|
||||||
assertSame(((ICPPSpecialization)cspec).getSpecializedBinding(), complex);
|
assertSame(((ICPPSpecialization) cspec).getSpecializedBinding(), complex);
|
||||||
|
|
||||||
assertSame(complex, col.getName(5).resolveBinding());
|
assertSame(complex, col.getName(5).resolveBinding());
|
||||||
assertSame(cspec, col.getName(6).resolveBinding());
|
assertSame(cspec, col.getName(6).resolveBinding());
|
||||||
|
@ -2374,7 +2374,7 @@ public class AST2TemplateTests extends AST2BaseTest {
|
||||||
assertInstance(tid.resolveBinding(), ICPPTemplateInstance.class); // *D<int>*(5, 6)
|
assertInstance(tid.resolveBinding(), ICPPTemplateInstance.class); // *D<int>*(5, 6)
|
||||||
assertInstance(tid.resolveBinding(), ICPPConstructor.class); // *D<int>*(5, 6)
|
assertInstance(tid.resolveBinding(), ICPPConstructor.class); // *D<int>*(5, 6)
|
||||||
|
|
||||||
IBinding tidSpc= ((ICPPTemplateInstance)tid.resolveBinding()).getSpecializedBinding();
|
IBinding tidSpc= ((ICPPTemplateInstance) tid.resolveBinding()).getSpecializedBinding();
|
||||||
assertInstance(tidSpc, ICPPConstructor.class);
|
assertInstance(tidSpc, ICPPConstructor.class);
|
||||||
assertInstance(tidSpc, ICPPSpecialization.class);
|
assertInstance(tidSpc, ICPPSpecialization.class);
|
||||||
assertInstance(tidSpc, ICPPFunctionTemplate.class);
|
assertInstance(tidSpc, ICPPFunctionTemplate.class);
|
||||||
|
@ -2807,7 +2807,7 @@ public class AST2TemplateTests extends AST2BaseTest {
|
||||||
tu.accept(col);
|
tu.accept(col);
|
||||||
|
|
||||||
assertInstance(col.getName(3), ICPPASTTemplateId.class);
|
assertInstance(col.getName(3), ICPPASTTemplateId.class);
|
||||||
assertInstance(((ICPPASTTemplateId)col.getName(3)).getTemplateArguments()[0], ICPPASTUnaryExpression.class);
|
assertInstance(((ICPPASTTemplateId) col.getName(3)).getTemplateArguments()[0], ICPPASTUnaryExpression.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
// template<class T1, int q> class C {};
|
// template<class T1, int q> class C {};
|
||||||
|
|
|
@ -7038,7 +7038,7 @@ public class AST2Tests extends AST2BaseTest {
|
||||||
// newArray var5;
|
// newArray var5;
|
||||||
//
|
//
|
||||||
// void foo() {
|
// void foo() {
|
||||||
// /* The type of the arraysubscript expression should be struct s
|
// /* The type of the array subscript expression should be struct s
|
||||||
// * each of the following statements
|
// * each of the following statements
|
||||||
// */
|
// */
|
||||||
// var1[1].a = 1;
|
// var1[1].a = 1;
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Markus Schorn - initial API and implementation
|
* Markus Schorn - initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.model.ext;
|
package org.eclipse.cdt.internal.core.model.ext;
|
||||||
|
|
||||||
|
@ -17,7 +17,6 @@ import org.eclipse.cdt.core.model.ICElement;
|
||||||
import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility;
|
import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility;
|
||||||
|
|
||||||
public class FieldHandle extends CElementHandle implements org.eclipse.cdt.core.model.IField {
|
public class FieldHandle extends CElementHandle implements org.eclipse.cdt.core.model.IField {
|
||||||
|
|
||||||
private ASTAccessVisibility fVisibility;
|
private ASTAccessVisibility fVisibility;
|
||||||
private String fTypeName;
|
private String fTypeName;
|
||||||
private boolean fIsStatic;
|
private boolean fIsStatic;
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* John Camelon (IBM Rational Software) - Initial API and implementation
|
* John Camelon (IBM Rational Software) - Initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.core.dom.ast;
|
package org.eclipse.cdt.core.dom.ast;
|
||||||
|
|
||||||
|
@ -142,7 +142,8 @@ public interface IASTUnaryExpression extends IASTExpression {
|
||||||
* <code>OPERAND</code> represents the relationship between an <code>IASTUnaryExpression</code> and
|
* <code>OPERAND</code> represents the relationship between an <code>IASTUnaryExpression</code> and
|
||||||
* it's nested <code>IASTExpression</code>.
|
* it's nested <code>IASTExpression</code>.
|
||||||
*/
|
*/
|
||||||
public static final ASTNodeProperty OPERAND = new ASTNodeProperty("IASTUnaryExpression.OPERAND - IASTExpression (operand) for IASTUnaryExpression"); //$NON-NLS-1$
|
public static final ASTNodeProperty OPERAND =
|
||||||
|
new ASTNodeProperty("IASTUnaryExpression.OPERAND - IASTExpression (operand) for IASTUnaryExpression"); //$NON-NLS-1$
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the operand.
|
* Get the operand.
|
||||||
|
|
|
@ -19,6 +19,7 @@ import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.ExpressionT
|
||||||
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.ExpressionTypes.typeFromReturnType;
|
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.ExpressionTypes.typeFromReturnType;
|
||||||
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.ExpressionTypes.valueCategoryFromFunctionCall;
|
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.ExpressionTypes.valueCategoryFromFunctionCall;
|
||||||
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.ExpressionTypes.valueCategoryFromReturnType;
|
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.ExpressionTypes.valueCategoryFromReturnType;
|
||||||
|
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.COND_TDEF;
|
||||||
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.CVTYPE;
|
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.CVTYPE;
|
||||||
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.REF;
|
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.REF;
|
||||||
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.TDEF;
|
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.TDEF;
|
||||||
|
@ -40,6 +41,7 @@ import org.eclipse.cdt.core.dom.ast.IProblemBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.ISemanticProblem;
|
import org.eclipse.cdt.core.dom.ast.ISemanticProblem;
|
||||||
import org.eclipse.cdt.core.dom.ast.IType;
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTExpressionList;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTExpressionList;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFieldReference;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionCallExpression;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionCallExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
|
||||||
|
@ -260,15 +262,16 @@ public class CPPASTFunctionCallExpression extends ASTNode
|
||||||
@Override
|
@Override
|
||||||
public IType getExpressionType() {
|
public IType getExpressionType() {
|
||||||
// Handle explicit type conversion in functional notation.
|
// Handle explicit type conversion in functional notation.
|
||||||
IType t= isExplicitTypeConversion();
|
IType type= isExplicitTypeConversion();
|
||||||
if (t != null) {
|
if (type != null) {
|
||||||
if (t instanceof IProblemBinding) {
|
if (type instanceof IProblemBinding) {
|
||||||
return ProblemType.UNRESOLVED_NAME;
|
return ProblemType.UNRESOLVED_NAME;
|
||||||
}
|
}
|
||||||
return prvalueType(t);
|
return prvalueType(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
t= SemanticUtil.getNestedType(functionName.getExpressionType(), TDEF | REF | CVTYPE);
|
type= SemanticUtil.getNestedType(functionName.getExpressionType(), COND_TDEF | REF | CVTYPE);
|
||||||
|
IType t = SemanticUtil.getNestedType(type, TDEF | REF | CVTYPE);
|
||||||
if (t instanceof ICPPClassType) {
|
if (t instanceof ICPPClassType) {
|
||||||
if (overload == UNINITIALIZED_FUNCTION) {
|
if (overload == UNINITIALIZED_FUNCTION) {
|
||||||
overload = CPPSemantics.findOverloadedOperator(this, (ICPPClassType) t);
|
overload = CPPSemantics.findOverloadedOperator(this, (ICPPClassType) t);
|
||||||
|
@ -283,9 +286,16 @@ public class CPPASTFunctionCallExpression extends ASTNode
|
||||||
t= SemanticUtil.getNestedType(((IPointerType) t).getType(), TDEF | REF | CVTYPE);
|
t= SemanticUtil.getNestedType(((IPointerType) t).getType(), TDEF | REF | CVTYPE);
|
||||||
}
|
}
|
||||||
if (t instanceof IFunctionType) {
|
if (t instanceof IFunctionType) {
|
||||||
return typeFromReturnType(((IFunctionType) t).getReturnType());
|
type = typeFromReturnType(((IFunctionType) t).getReturnType());
|
||||||
|
if (functionName instanceof ICPPASTFieldReference) {
|
||||||
|
IType ownerType = ((ICPPASTFieldReference) functionName).getFieldOwnerType();
|
||||||
|
t = SemanticUtil.substituteTypedef(type, ownerType);
|
||||||
|
if (t != null)
|
||||||
|
type = t;
|
||||||
|
}
|
||||||
|
return type;
|
||||||
}
|
}
|
||||||
if (CPPTemplates.isDependentType(t))
|
if (CPPTemplates.isDependentType(type))
|
||||||
return CPPUnknownClass.createUnnamedInstance();
|
return CPPUnknownClass.createUnnamedInstance();
|
||||||
|
|
||||||
return new ProblemType(ISemanticProblem.TYPE_UNKNOWN_FOR_EXPRESSION);
|
return new ProblemType(ISemanticProblem.TYPE_UNKNOWN_FOR_EXPRESSION);
|
||||||
|
|
|
@ -50,7 +50,8 @@ public class CPPFunctionSpecialization extends CPPSpecialization implements ICPP
|
||||||
this(orig, owner, argMap, null);
|
this(orig, owner, argMap, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public CPPFunctionSpecialization(ICPPFunction orig, IBinding owner, ICPPTemplateParameterMap argMap, ICPPClassSpecialization context) {
|
public CPPFunctionSpecialization(ICPPFunction orig, IBinding owner, ICPPTemplateParameterMap argMap,
|
||||||
|
ICPPClassSpecialization context) {
|
||||||
super(orig, owner, argMap);
|
super(orig, owner, argMap);
|
||||||
fContext= context;
|
fContext= context;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Andrew Niefer (IBM) - Initial API and implementation
|
* Andrew Niefer (IBM) - Initial API and implementation
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
package org.eclipse.cdt.internal.core.dom.parser.cpp;
|
||||||
|
|
||||||
|
@ -24,31 +24,31 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameterMap;
|
||||||
/**
|
/**
|
||||||
* The specialization of a method in the context of a class-specialization.
|
* The specialization of a method in the context of a class-specialization.
|
||||||
*/
|
*/
|
||||||
public class CPPMethodSpecialization extends CPPFunctionSpecialization
|
public class CPPMethodSpecialization extends CPPFunctionSpecialization implements ICPPMethod {
|
||||||
implements ICPPMethod {
|
|
||||||
|
|
||||||
public CPPMethodSpecialization(ICPPMethod orig, ICPPClassType owner, ICPPTemplateParameterMap argMap ) {
|
public CPPMethodSpecialization(ICPPMethod orig, ICPPClassType owner, ICPPTemplateParameterMap argMap) {
|
||||||
super(orig, owner, argMap );
|
super(orig, owner, argMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isVirtual() {
|
public boolean isVirtual() {
|
||||||
ICPPMethod f = (ICPPMethod) getSpecializedBinding();
|
ICPPMethod f = (ICPPMethod) getSpecializedBinding();
|
||||||
if( f != null )
|
if (f != null)
|
||||||
return f.isVirtual();
|
return f.isVirtual();
|
||||||
IASTNode definition = getDefinition();
|
IASTNode definition = getDefinition();
|
||||||
if( definition != null ){
|
if (definition != null) {
|
||||||
IASTNode node = definition.getParent();
|
IASTNode node = definition.getParent();
|
||||||
while( node instanceof IASTDeclarator )
|
while(node instanceof IASTDeclarator)
|
||||||
node = node.getParent();
|
node = node.getParent();
|
||||||
|
|
||||||
ICPPASTDeclSpecifier declSpec = null;
|
ICPPASTDeclSpecifier declSpec = null;
|
||||||
if( node instanceof IASTSimpleDeclaration )
|
if (node instanceof IASTSimpleDeclaration) {
|
||||||
declSpec = (ICPPASTDeclSpecifier) ((IASTSimpleDeclaration)node).getDeclSpecifier();
|
declSpec = (ICPPASTDeclSpecifier) ((IASTSimpleDeclaration) node).getDeclSpecifier();
|
||||||
else if( node instanceof IASTFunctionDefinition )
|
} else if (node instanceof IASTFunctionDefinition) {
|
||||||
declSpec = (ICPPASTDeclSpecifier) ((IASTFunctionDefinition)node).getDeclSpecifier();
|
declSpec = (ICPPASTDeclSpecifier) ((IASTFunctionDefinition) node).getDeclSpecifier();
|
||||||
|
}
|
||||||
|
|
||||||
if( declSpec != null ){
|
if (declSpec != null) {
|
||||||
return declSpec.isVirtual();
|
return declSpec.isVirtual();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,7 @@ public class CPPMethodSpecialization extends CPPFunctionSpecialization
|
||||||
@Override
|
@Override
|
||||||
public int getVisibility() {
|
public int getVisibility() {
|
||||||
ICPPMethod f = (ICPPMethod) getSpecializedBinding();
|
ICPPMethod f = (ICPPMethod) getSpecializedBinding();
|
||||||
if( f != null )
|
if (f != null)
|
||||||
return f.getVisibility();
|
return f.getVisibility();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -79,7 +79,7 @@ public class CPPMethodSpecialization extends CPPFunctionSpecialization
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isExplicit() {
|
public boolean isExplicit() {
|
||||||
return ((ICPPMethod)getSpecializedBinding()).isExplicit();
|
return ((ICPPMethod) getSpecializedBinding()).isExplicit();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Add table
Reference in a new issue