Support default arguments in symboldatabase for arguments without name (#4055)
This commit is contained in:
parent
6023ae423c
commit
c2d4afc525
|
@ -868,8 +868,13 @@ void Variable::evaluate()
|
|||
setFlag(fIsArray, arrayDimensions(_dimensions, _name->next()));
|
||||
if (_start)
|
||||
setFlag(fIsClass, !_start->isStandardType() && !isPointer() && !isReference());
|
||||
if (_access == Argument && _name) {
|
||||
tok = _name->next();
|
||||
if (_access == Argument) {
|
||||
tok = _name;
|
||||
if (!tok)
|
||||
tok = _end; // Argument without name
|
||||
if (!tok)
|
||||
return;
|
||||
tok = tok->next();
|
||||
while (tok->str() == "[")
|
||||
tok = tok->link();
|
||||
setFlag(fHasDefault, tok->str() == "=");
|
||||
|
|
|
@ -858,6 +858,12 @@ private:
|
|||
ASSERT(g && g->type == Scope::eFunction && g->function && g->function->argumentList.size() == 1 && g->function->argumentList.front().index() == 0 && g->function->initializedArgCount() == 1);
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
{
|
||||
GET_SYMBOL_DB("void g(int = 0) { }");
|
||||
const Scope* g = db->findScopeByName("g");
|
||||
ASSERT(g && g->type == Scope::eFunction && g->function && g->function->argumentList.size() == 1 && g->function->argumentList.front().hasDefault());
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
}
|
||||
|
||||
void functionArgs2() {
|
||||
|
|
Loading…
Reference in New Issue