SymbolDatabase: A token with a varId cannot be a function declaration
This commit is contained in:
parent
1734fc2e9a
commit
0ae09c0029
|
@ -1074,6 +1074,9 @@ SymbolDatabase::SymbolDatabase(const Tokenizer *tokenizer, const Settings *setti
|
|||
|
||||
bool SymbolDatabase::isFunction(const Token *tok, const Scope* outerScope, const Token **funcStart, const Token **argStart)
|
||||
{
|
||||
if (tok->varId())
|
||||
return false;
|
||||
|
||||
// function returning function pointer? '... ( ... %var% ( ... ))( ... ) {'
|
||||
if (tok->str() == "(" &&
|
||||
tok->link()->previous()->str() == ")") {
|
||||
|
|
|
@ -152,6 +152,7 @@ private:
|
|||
TEST_CASE(testConstructors);
|
||||
TEST_CASE(functionDeclarationTemplate);
|
||||
TEST_CASE(functionDeclarations);
|
||||
TEST_CASE(constructorInitialization);
|
||||
TEST_CASE(memberFunctionOfUnknownClassMacro1);
|
||||
TEST_CASE(memberFunctionOfUnknownClassMacro2);
|
||||
TEST_CASE(memberFunctionOfUnknownClassMacro3);
|
||||
|
@ -1054,6 +1055,19 @@ private:
|
|||
}
|
||||
}
|
||||
|
||||
void constructorInitialization() {
|
||||
GET_SYMBOL_DB("std::string logfile;\n"
|
||||
"std::ofstream log(logfile.c_str(), std::ios::out);");
|
||||
|
||||
// 1 scope: Global
|
||||
ASSERT(db && db->scopeList.size() == 1);
|
||||
|
||||
if (db && db->scopeList.size() >= 1) {
|
||||
// No functions
|
||||
ASSERT(db->scopeList.front().functionList.empty());
|
||||
}
|
||||
}
|
||||
|
||||
void memberFunctionOfUnknownClassMacro1() {
|
||||
GET_SYMBOL_DB("class ScVbaFormatCondition { OUString getServiceImplName() SAL_OVERRIDE; };\n"
|
||||
"void ScVbaValidation::getFormula1() {\n"
|
||||
|
|
Loading…
Reference in New Issue