SymbolDatabase: Add test to ensure findFunction looks in current scope first

This commit is contained in:
Daniel Marjamäki 2019-10-03 21:28:41 +02:00
parent 40f136ac78
commit 2a33c3cfec
1 changed files with 14 additions and 0 deletions

View File

@ -345,6 +345,7 @@ private:
TEST_CASE(findFunction25); // std::vector<std::shared_ptr<Fred>>
TEST_CASE(findFunction26); // #8668 - pointer parameter in function call, const pointer function argument
TEST_CASE(findFunction27);
TEST_CASE(findFunction28);
TEST_CASE(findFunctionContainer);
TEST_CASE(valueTypeMatchParameter); // ValueType::matchParameter
@ -5577,6 +5578,19 @@ private:
ASSERT(a->function());
}
void findFunction28() {
GET_SYMBOL_DB("namespace { void a(int); }\n"
"struct S {\n"
" void foo() { a(7); }\n"
" void a(int);\n"
"};");
const Token *a = Token::findsimplematch(tokenizer.tokens(), "a ( 7 )");
ASSERT(a);
ASSERT(a->function());
ASSERT(a->function()->token);
ASSERT_EQUALS(4, a->function()->token->linenr());
}
void findFunctionContainer() {
{
GET_SYMBOL_DB("void dostuff(std::vector<int> v);\n"