- enhancement: Support operator() overload.

This commit is contained in:
Roy Qu 2024-06-02 18:57:52 +08:00
parent c83da8309c
commit 1f6ef884e6
2 changed files with 19 additions and 0 deletions

View File

@ -15,6 +15,7 @@ Red Panda C++ Version 3.1
- fix: Mingw32-make doesn't work correctly if there are bash in the path.
- fix: All color scheme names are incorrectly displayed as bold, if the current one is a customed one.
- fix: Variables defined by using alias can't show completion info.
- enhancement: Support operator() overload.
Red Panda C++ Version 3.0

View File

@ -5127,6 +5127,24 @@ PEvalStatement CppParser::doEvalMemberAccess(const QString &fileName,
// if (result->effectiveTypeStatement)
// qDebug()<<"typeStatement"<<result->effectiveTypeStatement->fullName;
result->kind = EvalStatementKind::Variable;
} else if(result->kind == EvalStatementKind::Variable
&& result->effectiveTypeStatement
&& result->effectiveTypeStatement->kind == StatementKind::Class) {
//overload of operator ()
const StatementMap& statementMap = mStatementList.childrenStatements(result->effectiveTypeStatement);
if (statementMap.isEmpty())
result = PEvalStatement();
else {
PStatement operStatement = statementMap.value("operator()");
if (operStatement) {
doSkipInExpression(phraseExpression,pos,"(",")");
PEvalStatement temp = doCreateEvalFunction(fileName,operStatement);
result->effectiveTypeStatement = temp->effectiveTypeStatement;
result->kind = EvalStatementKind::Variable;
} else {
result = PEvalStatement();
}
}
} else {
result = PEvalStatement();
}