C++: Fix some Matcher::match() functions

...before using Matcher instead of {Type,Name}::isEqualTo().

Change-Id: Iba1c04064799fe9c81fe997dbd54fc02b15cdec7
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
This commit is contained in:
Nikolai Kosjar
2014-05-15 15:15:02 -04:00
parent 194591da98
commit 558f62ec71
4 changed files with 79 additions and 31 deletions

View File

@@ -222,7 +222,7 @@ int Function::methodKey() const
void Function::setMethodKey(int key)
{ f._methodKey = key; }
bool Function::isSignatureEqualTo(const Function *other) const
bool Function::isSignatureEqualTo(const Function *other, Matcher *matcher) const
{
if (! other)
return false;
@@ -230,22 +230,19 @@ bool Function::isSignatureEqualTo(const Function *other) const
return false;
else if (isVolatile() != other->isVolatile())
return false;
else if (! Matcher::match(unqualifiedName(), other->unqualifiedName(), matcher))
return false;
const Name *l = unqualifiedName();
const Name *r = other->unqualifiedName();
if (l == r || (l && l->isEqualTo(r))) {
const unsigned argc = argumentCount();
if (argc != other->argumentCount())
const unsigned argc = argumentCount();
if (argc != other->argumentCount())
return false;
for (unsigned i = 0; i < argc; ++i) {
Symbol *l = argumentAt(i);
Symbol *r = other->argumentAt(i);
if (! l->type().match(r->type(), matcher))
return false;
for (unsigned i = 0; i < argc; ++i) {
Symbol *l = argumentAt(i);
Symbol *r = other->argumentAt(i);
if (! l->type().isEqualTo(r->type()))
return false;
}
return true;
}
return false;
return true;
}
bool Function::isEqualTo(const Type *other) const