1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-01 06:05:24 +02:00

201177: apply fix + add test from Sergey

This commit is contained in:
Andrew Ferguson 2007-11-06 11:13:48 +00:00
parent 8629e6b5d1
commit 1be0d21863
5 changed files with 51 additions and 6 deletions

View file

@ -8,6 +8,7 @@
* Contributors:
* Andrew Ferguson (Symbian) - Initial implementation
* Markus Schorn (Wind River Systems)
* Sergey Prigogin (Google)
*******************************************************************************/
package org.eclipse.cdt.internal.index.tests;
@ -32,6 +33,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPField;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunction;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespace;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespaceScope;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPPointerToMemberType;
@ -61,6 +63,45 @@ public abstract class IndexCPPBindingResolutionTest extends IndexBindingResoluti
suite.addTest(suite(ProjectWithDepProj.class));
}
// namespace ns { class A; enum E {E1}; typedef int T; }
//
// class B {
// public:
// void m(ns::A* a);
// void n(ns::E* a);
// void o(ns::T* a);
// void p(ns::E a);
// };
// namespace ns {
// class A {};
// typedef int T;
// }
//
// using ns::A;
// using ns::E;
// using ns::T;
// using ns::E1;
//
// void B::m(A* a) {}
// void B::n(E* a) {}
// void B::o(T* a) {}
// void B::p(E a) {}
//
// void usage() {
// B b;
// b.p(E1);
// }
public void testUsingTypeDirective_201177() {
IBinding b0= getBindingFromASTName("B::m", 4);
IBinding b1= getBindingFromASTName("B::n", 4);
IBinding b2= getBindingFromASTName("B::o", 4);
IBinding b3= getBindingFromASTName("p(E1)", 1);
assertInstance(b0, ICPPMethod.class);
assertInstance(b1, ICPPMethod.class);
assertInstance(b2, ICPPMethod.class);
}
// namespace n { class A{}; class B{}; class C{}; }
// namespace m {

View file

@ -9,6 +9,7 @@
* IBM Corporation - initial API and implementation
* Markus Schorn (Wind River Systems)
* Bryan Wilkinson (QNX)
* Sergey Prigogin (Google)
*******************************************************************************/
/*
* Created on Nov 29, 2004
@ -794,10 +795,10 @@ public class CPPClassType extends PlatformObject implements ICPPClassType, ICPPI
* @see org.eclipse.cdt.core.dom.ast.IType#isSameType(org.eclipse.cdt.core.dom.ast.IType)
*/
public boolean isSameType( IType type ) {
if( type == this )
if (type == this)
return true;
if( type instanceof ITypedef || type instanceof IIndexType)
return type.isSameType( this );
if (type instanceof ITypedef || type instanceof IIndexType || type instanceof ICPPDelegate)
return type.isSameType(this);
return false;
}

View file

@ -8,6 +8,7 @@
* Contributors:
* IBM Corporation - initial API and implementation
* Markus Schorn (Wind River Systems)
* Sergey Prigogin (Google)
*******************************************************************************/
/*
@ -188,7 +189,7 @@ public class CPPEnumeration extends PlatformObject implements IEnumeration, ICPP
public boolean isSameType( IType type ) {
if( type == this )
return true;
if( type instanceof ITypedef || type instanceof IIndexType)
if( type instanceof ITypedef || type instanceof IIndexType || type instanceof ICPPDelegate)
return type.isSameType( this );
return false;
}

View file

@ -10,6 +10,7 @@
* Markus Schorn (Wind River Systems)
* Andrew Ferguson (Symbian)
* Bryan Wilkinson (QNX)
* Sergey Prigogin (Google)
*******************************************************************************/
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
@ -129,7 +130,7 @@ class PDOMCPPClassType extends PDOMCPPBinding implements ICPPClassType,
}
public boolean isSameType(IType type) {
if (type instanceof ITypedef) {
if (type instanceof ITypedef || type instanceof ICPPDelegate) {
return type.isSameType(this);
}

View file

@ -8,6 +8,7 @@
* Contributors:
* QNX - Initial API and implementation
* Markus Schorn (Wind River Systems)
* Sergey Prigogin (Google)
*******************************************************************************/
package org.eclipse.cdt.internal.core.pdom.dom.cpp;
@ -98,7 +99,7 @@ class PDOMCPPEnumeration extends PDOMCPPBinding
}
public boolean isSameType(IType type) {
if (type instanceof ITypedef) {
if (type instanceof ITypedef || type instanceof ICPPDelegate) {
return type.isSameType(this);
}