- enhancement: when induce type info for return value, try to select the overloaded one that doesn't have an "auto" type.

This commit is contained in:
Roy Qu 2023-10-26 08:57:40 +08:00
parent 9acca16f8e
commit 5814043302
2 changed files with 21 additions and 1 deletions

View File

@ -20,6 +20,7 @@ Red Panda C++ Version 2.26
- fix: Code suggestion for identifiers after '*' (eg. 3 * item->price) can't correct. - fix: Code suggestion for identifiers after '*' (eg. 3 * item->price) can't correct.
- fix: C++ compiler atrribute '[[xxx]]' are not correctly handled. - fix: C++ compiler atrribute '[[xxx]]' are not correctly handled.
- fix: If the integrated gcc compiler is add to path, auto find compilers will find in twice. (Windows) - fix: If the integrated gcc compiler is add to path, auto find compilers will find in twice. (Windows)
- enhancement: when induce type info for return value, try to select the overloaded one that doesn't have an "auto" type.
Red Panda C++ Version 2.25 Red Panda C++ Version 2.25

View File

@ -5003,6 +5003,13 @@ PEvalStatement CppParser::doEvalMemberAccess(const QString &fileName,
} }
} }
// qDebug()<<"baseType:"<<result->baseType;
// if (result->baseStatement)
// qDebug()<<"baseStatement"<<result->baseStatement->fullName;
// if (result->typeStatement)
// qDebug()<<"typeStatement"<<result->typeStatement->fullName;
// if (result->effectiveTypeStatement)
// qDebug()<<"typeStatement"<<result->effectiveTypeStatement->fullName;
result->kind = EvalStatementKind::Variable; result->kind = EvalStatementKind::Variable;
} else } else
result = PEvalStatement(); result = PEvalStatement();
@ -5280,8 +5287,20 @@ PEvalStatement CppParser::doEvalTerm(const QString &fileName,
case StatementKind::skTypedef: case StatementKind::skTypedef:
result = doCreateEvalType(fileName,statement); result = doCreateEvalType(fileName,statement);
break; break;
case StatementKind::skFunction: case StatementKind::skFunction: {
if (statement->type=="auto") {
PStatement scopeStatement = statement->parentScope.lock();
if (scopeStatement) {
StatementMap children = mStatementList.childrenStatements(scopeStatement);
QList<PStatement> lstFuncs = children.values(statement->command);
for (const PStatement& func:lstFuncs) {
if (func->type!="auto")
statement=func;
}
}
}
result = doCreateEvalFunction(fileName,statement); result = doCreateEvalFunction(fileName,statement);
}
break; break;
case StatementKind::skPreprocessor: case StatementKind::skPreprocessor:
// qDebug()<<"before"<<phraseExpression; // qDebug()<<"before"<<phraseExpression;