forked from qt-creator/qt-creator
C++: Fix matching NamedType
NamedType::isEqualTo() wasn't properly moved to Matcher. In the test case, the function argument matching was failing. Change-Id: Ia3cb82c11b039ddea61a41d9574f56d43da16ed0 Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
This commit is contained in:
10
src/libs/3rdparty/cplusplus/Matcher.cpp
vendored
10
src/libs/3rdparty/cplusplus/Matcher.cpp
vendored
@@ -159,7 +159,15 @@ bool Matcher::match(const NamedType *type, const NamedType *otherType)
|
||||
if (type == otherType)
|
||||
return true;
|
||||
|
||||
else if (! Matcher::match(type->name(), otherType->name(), this))
|
||||
const Name *name = type->name();
|
||||
if (const QualifiedNameId *q = name->asQualifiedNameId())
|
||||
name = q->name();
|
||||
|
||||
const Name *otherName = otherType->name();
|
||||
if (const QualifiedNameId *q = otherName->asQualifiedNameId())
|
||||
otherName = q->name();
|
||||
|
||||
if (! Matcher::match(name, otherName, this))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
||||
@@ -962,6 +962,16 @@ void CppEditorPlugin::test_FollowSymbolUnderCursor_multipleDocuments_data()
|
||||
"void Foo::$foo(int) {}\n",
|
||||
"foo.cpp")
|
||||
);
|
||||
|
||||
QTest::newRow("matchFunctionSignature2") << (QList<TestDocumentPtr>()
|
||||
<< TestDocument::create("namespace N { class C; }\n"
|
||||
"bool *@fun(N::C *) const;\n",
|
||||
"foo.h")
|
||||
<< TestDocument::create("#include \"foo.h\"\n"
|
||||
"using namespace N;\n"
|
||||
"bool *$fun(C *) const {}\n",
|
||||
"foo.cpp")
|
||||
);
|
||||
}
|
||||
|
||||
void CppEditorPlugin::test_FollowSymbolUnderCursor_multipleDocuments()
|
||||
|
||||
Reference in New Issue
Block a user