- fix: lambda expression is not correctly handled.

This commit is contained in:
Roy Qu 2023-05-24 19:30:38 +08:00
parent c304f3f8a0
commit d4ccdbcdc2
2 changed files with 15 additions and 6 deletions

View File

@ -1901,10 +1901,17 @@ void CppParser::checkAndHandleMethodOrVar(KeywordType keywordType)
return; return;
} }
//it's not a function define //it's not a function define
if (mTokenizer[indexAfter]->text[0] == ',') { if (mTokenizer[indexAfter]->text != ';'
// var decl with init && mTokenizer[indexAfter]->text != '{'
handleVar(sType+" "+sName,isExtern,isStatic); && mTokenizer[indexAfter]->text != "->") {
return;
if (mTokenizer[indexAfter]->text == ',') {
// var decl with init
handleVar(sType+" "+sName,isExtern,isStatic);
return;
}
return ;
} }
if (mTokenizer[indexAfter]->text[0] == ';' && sType!="void") { if (mTokenizer[indexAfter]->text[0] == ';' && sType!="void") {
//function can only be defined in global/namespaces/classes //function can only be defined in global/namespaces/classes
@ -3664,6 +3671,8 @@ void CppParser::handleVar(const QString& typePrefix,bool isExtern,bool isStatic)
} else if (typePrefix=="static") { } else if (typePrefix=="static") {
isStatic=true; isStatic=true;
} else { } else {
if (typePrefix.back()==':')
return;
lastType=typePrefix.trimmed(); lastType=typePrefix.trimmed();
} }
@ -3981,7 +3990,7 @@ void CppParser::internalParse(const QString &fileName)
if (mTokenizer.tokenCount() == 0) if (mTokenizer.tokenCount() == 0)
return; return;
#ifdef QT_DEBUG #ifdef QT_DEBUG
// mTokenizer.dumpTokens(QString("r:\\tokens-%1.txt").arg(extractFileName(fileName))); // mTokenizer.dumpTokens(QString("r:\\tokens-%1.txt").arg(extractFileName(fileName)));
#endif #endif
#ifdef QT_DEBUG #ifdef QT_DEBUG
mLastIndex = -1; mLastIndex = -1;