mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Cosmetics.
This commit is contained in:
parent
aefea16bcf
commit
2cdce220b9
4 changed files with 178 additions and 178 deletions
|
@ -72,6 +72,108 @@ public abstract class IndexCPPBindingResolutionTest extends IndexBindingResoluti
|
|||
suite.addTest(ProjectWithDepProj.suite());
|
||||
}
|
||||
|
||||
/* Assertion helpers */
|
||||
/* ##################################################################### */
|
||||
|
||||
static protected void assertField(
|
||||
IBinding binding,
|
||||
String qn,
|
||||
Class expType,
|
||||
String expTypeQN) {
|
||||
assertTrue(binding instanceof ICPPField);
|
||||
ICPPField field = (ICPPField) binding;
|
||||
assertQNEquals(qn, field);
|
||||
assertTrue(expType.isInstance(field.getType()));
|
||||
if (expTypeQN != null) {
|
||||
assert(field.getType() instanceof ICPPBinding);
|
||||
ICPPBinding tyBinding = (ICPPBinding) field.getType();
|
||||
assertQNEquals(expTypeQN, tyBinding);
|
||||
}
|
||||
}
|
||||
|
||||
static protected void assertClassTypeBinding(IBinding binding,
|
||||
String qn,
|
||||
int key,
|
||||
int bases,
|
||||
int fields,
|
||||
int declaredFields,
|
||||
int methods,
|
||||
int declaredMethods,
|
||||
int allDeclaredMethods,
|
||||
int friends,
|
||||
int constructors,
|
||||
int nestedClasses) {
|
||||
assertTrue(binding instanceof ICPPClassType);
|
||||
assertClassType((ICPPClassType) binding, qn, key, bases, fields, declaredFields, methods,
|
||||
declaredMethods, allDeclaredMethods, friends, constructors, nestedClasses);
|
||||
}
|
||||
|
||||
static protected void assertClassType(
|
||||
IType type,
|
||||
String qn,
|
||||
int key,
|
||||
int bases,
|
||||
int fields,
|
||||
int declaredFields,
|
||||
int methods,
|
||||
int declaredMethods,
|
||||
int allDeclaredMethods,
|
||||
int friends,
|
||||
int constructors,
|
||||
int nestedClasses) {
|
||||
assertTrue(type instanceof ICPPClassType);
|
||||
ICPPClassType classType = (ICPPClassType) type;
|
||||
assertQNEquals(qn, classType);
|
||||
assertEquals(key, classType.getKey());
|
||||
assertEquals(bases, classType.getBases().length);
|
||||
assertEquals(fields, classType.getFields().length);
|
||||
assertEquals(declaredFields, classType.getDeclaredFields().length);
|
||||
assertEquals(methods, classType.getMethods().length);
|
||||
assertEquals(declaredMethods, classType.getDeclaredMethods().length);
|
||||
assertEquals(allDeclaredMethods, classType.getAllDeclaredMethods().length);
|
||||
assertEquals(friends, classType.getFriends().length);
|
||||
assertEquals(constructors, classType.getConstructors().length);
|
||||
assertEquals(nestedClasses, classType.getNestedClasses().length);
|
||||
}
|
||||
|
||||
public void assertEnumeration(IBinding binding, String name, String[] enumerators) throws DOMException {
|
||||
assertTrue(binding instanceof IEnumeration);
|
||||
assertEquals(name, binding.getName());
|
||||
IEnumerator[] aEnumerators = ((IEnumeration)binding).getEnumerators();
|
||||
Set expectedEnumerators = new HashSet();
|
||||
expectedEnumerators.addAll(Arrays.asList(enumerators));
|
||||
Set actualEnumerators = new HashSet();
|
||||
for (IEnumerator enumerator : aEnumerators) {
|
||||
actualEnumerators.add(enumerator.getName());
|
||||
}
|
||||
assertEquals(expectedEnumerators, actualEnumerators);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param type
|
||||
* @param cqn
|
||||
* @param qn may be null
|
||||
*/
|
||||
static protected void assertPTM(IType type, String cqn, String qn) {
|
||||
assertTrue(type instanceof ICPPPointerToMemberType);
|
||||
ICPPPointerToMemberType ptmt = (ICPPPointerToMemberType) type;
|
||||
ICPPClassType classType = (ICPPClassType) ptmt.getMemberOfClass();
|
||||
assertQNEquals(cqn, classType);
|
||||
if (qn != null) {
|
||||
assert(ptmt.getType() instanceof ICPPBinding);
|
||||
ICPPBinding tyBinding = (ICPPBinding) ptmt.getType();
|
||||
assertQNEquals(qn, tyBinding);
|
||||
}
|
||||
}
|
||||
|
||||
private void asserValueEquals(IValue initialValue, long i) {
|
||||
assertNotNull(initialValue);
|
||||
final Long numericalValue = initialValue.numericalValue();
|
||||
assertNotNull(numericalValue);
|
||||
assertEquals(i, numericalValue.longValue());
|
||||
}
|
||||
|
||||
|
||||
// namespace ns { class A; enum E {E1}; typedef int T; }
|
||||
//
|
||||
// class B {
|
||||
|
@ -1613,105 +1715,4 @@ public abstract class IndexCPPBindingResolutionTest extends IndexBindingResoluti
|
|||
getBindingFromASTName("f(a)", 1, ICPPFunction.class);
|
||||
getBindingFromASTName("g(b)", 1, ICPPFunction.class);
|
||||
}
|
||||
|
||||
/* CPP assertion helpers */
|
||||
/* ##################################################################### */
|
||||
|
||||
static protected void assertField(
|
||||
IBinding binding,
|
||||
String qn,
|
||||
Class expType,
|
||||
String expTypeQN) {
|
||||
assertTrue(binding instanceof ICPPField);
|
||||
ICPPField field = (ICPPField) binding;
|
||||
assertQNEquals(qn, field);
|
||||
assertTrue(expType.isInstance(field.getType()));
|
||||
if (expTypeQN != null) {
|
||||
assert(field.getType() instanceof ICPPBinding);
|
||||
ICPPBinding tyBinding = (ICPPBinding) field.getType();
|
||||
assertQNEquals(expTypeQN, tyBinding);
|
||||
}
|
||||
}
|
||||
|
||||
static protected void assertClassTypeBinding(IBinding binding,
|
||||
String qn,
|
||||
int key,
|
||||
int bases,
|
||||
int fields,
|
||||
int declaredFields,
|
||||
int methods,
|
||||
int declaredMethods,
|
||||
int allDeclaredMethods,
|
||||
int friends,
|
||||
int constructors,
|
||||
int nestedClasses) {
|
||||
assertTrue(binding instanceof ICPPClassType);
|
||||
assertClassType((ICPPClassType) binding, qn, key, bases, fields, declaredFields, methods,
|
||||
declaredMethods, allDeclaredMethods, friends, constructors, nestedClasses);
|
||||
}
|
||||
|
||||
static protected void assertClassType(
|
||||
IType type,
|
||||
String qn,
|
||||
int key,
|
||||
int bases,
|
||||
int fields,
|
||||
int declaredFields,
|
||||
int methods,
|
||||
int declaredMethods,
|
||||
int allDeclaredMethods,
|
||||
int friends,
|
||||
int constructors,
|
||||
int nestedClasses) {
|
||||
assertTrue(type instanceof ICPPClassType);
|
||||
ICPPClassType classType = (ICPPClassType) type;
|
||||
assertQNEquals(qn, classType);
|
||||
assertEquals(key, classType.getKey());
|
||||
assertEquals(bases, classType.getBases().length);
|
||||
assertEquals(fields, classType.getFields().length);
|
||||
assertEquals(declaredFields, classType.getDeclaredFields().length);
|
||||
assertEquals(methods, classType.getMethods().length);
|
||||
assertEquals(declaredMethods, classType.getDeclaredMethods().length);
|
||||
assertEquals(allDeclaredMethods, classType.getAllDeclaredMethods().length);
|
||||
assertEquals(friends, classType.getFriends().length);
|
||||
assertEquals(constructors, classType.getConstructors().length);
|
||||
assertEquals(nestedClasses, classType.getNestedClasses().length);
|
||||
}
|
||||
|
||||
public void assertEnumeration(IBinding binding, String name, String[] enumerators) throws DOMException {
|
||||
assertTrue(binding instanceof IEnumeration);
|
||||
assertEquals(name, binding.getName());
|
||||
IEnumerator[] aEnumerators = ((IEnumeration)binding).getEnumerators();
|
||||
Set expectedEnumerators = new HashSet();
|
||||
expectedEnumerators.addAll(Arrays.asList(enumerators));
|
||||
Set actualEnumerators = new HashSet();
|
||||
for (IEnumerator enumerator : aEnumerators) {
|
||||
actualEnumerators.add(enumerator.getName());
|
||||
}
|
||||
assertEquals(expectedEnumerators, actualEnumerators);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param type
|
||||
* @param cqn
|
||||
* @param qn may be null
|
||||
*/
|
||||
static protected void assertPTM(IType type, String cqn, String qn) {
|
||||
assertTrue(type instanceof ICPPPointerToMemberType);
|
||||
ICPPPointerToMemberType ptmt = (ICPPPointerToMemberType) type;
|
||||
ICPPClassType classType = (ICPPClassType) ptmt.getMemberOfClass();
|
||||
assertQNEquals(cqn, classType);
|
||||
if (qn != null) {
|
||||
assert(ptmt.getType() instanceof ICPPBinding);
|
||||
ICPPBinding tyBinding = (ICPPBinding) ptmt.getType();
|
||||
assertQNEquals(qn, tyBinding);
|
||||
}
|
||||
}
|
||||
|
||||
private void asserValueEquals(IValue initialValue, long i) {
|
||||
assertNotNull(initialValue);
|
||||
final Long numericalValue = initialValue.numericalValue();
|
||||
assertNotNull(numericalValue);
|
||||
assertEquals(i, numericalValue.longValue());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -80,7 +80,7 @@ public class CPPNamespaceScope extends CPPScope implements ICPPInternalNamespace
|
|||
private void initUsingDirectives() {
|
||||
if (fUsingDirectives == null) {
|
||||
fUsingDirectives= new ArrayList<ICPPUsingDirective>(1);
|
||||
// Insert a using directive for every inline namespace found in the index
|
||||
// Insert a using directive for every inline namespace found in the index.
|
||||
for (ICPPInternalNamespaceScope inline : getIndexInlineNamespaces()) {
|
||||
if (!(inline instanceof CPPNamespaceScope)) {
|
||||
fUsingDirectives.add(new InlineNamespaceDirective(this, inline));
|
||||
|
|
|
@ -50,7 +50,6 @@ import org.eclipse.core.runtime.CoreException;
|
|||
*/
|
||||
class PDOMCPPNamespace extends PDOMCPPBinding
|
||||
implements ICPPNamespace, ICPPNamespaceScope, IIndexScope {
|
||||
|
||||
private static final int INDEX_OFFSET = PDOMCPPBinding.RECORD_SIZE;
|
||||
private static final int FIRST_NAMESPACE_CHILD_OFFSET = INDEX_OFFSET + Database.PTR_SIZE;
|
||||
private static final int NEXT_NAMESPACE_SIBBLING_OFFSET = FIRST_NAMESPACE_CHILD_OFFSET + Database.PTR_SIZE;
|
||||
|
|
Loading…
Add table
Reference in a new issue