Fixed bug in symboldatabase: Don't ignore const or static on variables declared that are declared with both keywords. (Fixes #3805)
This commit is contained in:
parent
4ae8e4f382
commit
132a95b5f2
|
@ -809,7 +809,7 @@ bool SymbolDatabase::isFunction(const Token *tok, const Scope* outerScope, const
|
||||||
void Variable::evaluate()
|
void Variable::evaluate()
|
||||||
{
|
{
|
||||||
const Token* tok = _start;
|
const Token* tok = _start;
|
||||||
if (tok && tok->previous() && tok->previous()->isName())
|
while (tok && tok->previous() && tok->previous()->isName())
|
||||||
tok = tok->previous();
|
tok = tok->previous();
|
||||||
for (const Token* const end = _name?_name:_end; tok != end;) {
|
for (const Token* const end = _name?_name:_end; tok != end;) {
|
||||||
if (tok->str() == "static")
|
if (tok->str() == "static")
|
||||||
|
|
|
@ -86,6 +86,8 @@ private:
|
||||||
TEST_CASE(isVariableDeclarationDoesNotIdentifyTemplateClass);
|
TEST_CASE(isVariableDeclarationDoesNotIdentifyTemplateClass);
|
||||||
TEST_CASE(isVariableDeclarationPointerConst);
|
TEST_CASE(isVariableDeclarationPointerConst);
|
||||||
|
|
||||||
|
TEST_CASE(staticMemberVar);
|
||||||
|
|
||||||
TEST_CASE(hasRegularFunction);
|
TEST_CASE(hasRegularFunction);
|
||||||
TEST_CASE(hasInlineClassFunction);
|
TEST_CASE(hasInlineClassFunction);
|
||||||
TEST_CASE(hasMissingInlineClassFunction);
|
TEST_CASE(hasMissingInlineClassFunction);
|
||||||
|
@ -464,6 +466,17 @@ private:
|
||||||
ASSERT(false == v.isReference());
|
ASSERT(false == v.isReference());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void staticMemberVar() {
|
||||||
|
GET_SYMBOL_DB("class Foo {\n"
|
||||||
|
" static const double d;\n"
|
||||||
|
"};\n"
|
||||||
|
"const double Foo::d = 5.0;");
|
||||||
|
|
||||||
|
const Variable* v = db->getVariableFromVarId(1);
|
||||||
|
ASSERT(v && db->getVariableListSize() == 2);
|
||||||
|
ASSERT(v && v->isStatic() && v->isConst() && v->isPrivate());
|
||||||
|
}
|
||||||
|
|
||||||
void hasRegularFunction() {
|
void hasRegularFunction() {
|
||||||
GET_SYMBOL_DB("void func() { }\n")
|
GET_SYMBOL_DB("void func() { }\n")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue