…er enum has same name as outer class
This commit is contained in:
parent
c1aed9681d
commit
d3d70dcc4e
|
@ -5086,9 +5086,13 @@ const Enumerator * SymbolDatabase::findEnumerator(const Token * tok, std::set<st
|
|||
else {
|
||||
// FIXME search base class here
|
||||
|
||||
const Scope* temp = nullptr;
|
||||
if (scope)
|
||||
temp = scope->findRecordInNestedList(tok1->str());
|
||||
// find first scope
|
||||
while (scope && scope->nestedIn) {
|
||||
const Scope* temp = scope->nestedIn->findRecordInNestedList(tok1->str());
|
||||
if (!temp)
|
||||
temp = scope->nestedIn->findRecordInNestedList(tok1->str());
|
||||
if (!temp && scope->functionOf)
|
||||
temp = scope->functionOf->findRecordInNestedList(tok1->str());
|
||||
if (temp) {
|
||||
|
|
|
@ -5975,6 +5975,27 @@ private:
|
|||
ASSERT(e && e->enumerator());
|
||||
ASSERT_EQUALS(E0, e->enumerator());
|
||||
}
|
||||
{
|
||||
GET_SYMBOL_DB("struct S {\n"
|
||||
" enum class E {\n"
|
||||
" A, D\n"
|
||||
" } e = E::D;\n"
|
||||
"};\n"
|
||||
"struct E {\n"
|
||||
" enum { A, B, C, D };\n"
|
||||
"};\n");
|
||||
ASSERT(db != nullptr);
|
||||
auto it = db->scopeList.begin();
|
||||
std::advance(it, 2);
|
||||
ASSERT_EQUALS(it->className, "E");
|
||||
ASSERT(it->nestedIn);
|
||||
ASSERT_EQUALS(it->nestedIn->className, "S");
|
||||
const Enumerator* D = it->findEnumerator("D");
|
||||
ASSERT(D && D->value_known && D->value == 1);
|
||||
const Token* tok = Token::findsimplematch(tokenizer.tokens(), "D ;");
|
||||
ASSERT(tok && tok->enumerator());
|
||||
ASSERT_EQUALS(D, tok->enumerator());
|
||||
}
|
||||
}
|
||||
|
||||
void sizeOfType() {
|
||||
|
|
Loading…
Reference in New Issue