parent
44c149e51b
commit
85332b2af6
|
@ -5688,21 +5688,25 @@ const Function* Scope::findFunction(const Token *tok, bool requireConst) const
|
|||
return matches[0];
|
||||
|
||||
// Prioritize matches in derived scopes
|
||||
for (const auto& fb : { fallback1Func, fallback2Func }) {
|
||||
const Function* ret = nullptr;
|
||||
for (int i = 0; i < fallback1Func.size(); ++i) {
|
||||
if (std::find(matches.cbegin(), matches.cend(), fallback1Func[i]) == matches.cend())
|
||||
for (int i = 0; i < fb.size(); ++i) {
|
||||
if (std::find(matches.cbegin(), matches.cend(), fb[i]) == matches.cend())
|
||||
continue;
|
||||
if (this == fallback1Func[i]->nestedIn) {
|
||||
if (this == fb[i]->nestedIn) {
|
||||
if (!ret)
|
||||
ret = fallback1Func[i];
|
||||
ret = fb[i];
|
||||
else {
|
||||
ret = nullptr;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
|
|
@ -7306,6 +7306,7 @@ private:
|
|||
}
|
||||
|
||||
void findFunction50() {
|
||||
{
|
||||
GET_SYMBOL_DB("struct B { B(); void init(unsigned int value); };\n"
|
||||
"struct D: B { D(); void init(unsigned int value); };\n"
|
||||
"D::D() { init(0); }\n"
|
||||
|
@ -7314,6 +7315,16 @@ private:
|
|||
ASSERT(call && call->function() && call->function()->functionScope);
|
||||
}
|
||||
|
||||
{
|
||||
GET_SYMBOL_DB("struct B { B(); void init(unsigned int value); };\n"
|
||||
"struct D: B { D(); void init(unsigned int value); };\n"
|
||||
"D::D() { init(0ULL); }\n"
|
||||
"void D::init(unsigned int value) {}\n");
|
||||
const Token* call = Token::findsimplematch(tokenizer.tokens(), "init ( 0ULL ) ;");
|
||||
ASSERT(call && call->function() && call->function()->functionScope);
|
||||
}
|
||||
}
|
||||
|
||||
void findFunctionContainer() {
|
||||
{
|
||||
GET_SYMBOL_DB("void dostuff(std::vector<int> v);\n"
|
||||
|
|
Loading…
Reference in New Issue