- fix: lambda expression is not correctly handled.

This commit is contained in:
Roy Qu 2023-05-24 17:02:59 +08:00
parent d37652a236
commit c304f3f8a0
2 changed files with 5 additions and 4 deletions

View File

@ -4,6 +4,7 @@ Red Panda C++ Version 2.22
- fix: Double-clicking on touchpad can't select current word. - fix: Double-clicking on touchpad can't select current word.
- fix: foreach-loops are not correctly parsed. - fix: foreach-loops are not correctly parsed.
- fix: '^' is not correctly handled as operator. - fix: '^' is not correctly handled as operator.
- fix: lambda expression is not correctly handled.
Red Panda C++ Version 2.21 Red Panda C++ Version 2.21

View File

@ -2516,7 +2516,7 @@ void CppParser::handleLambda(int index, int endIndex)
return; return;
} }
int bodyEnd = mTokenizer[bodyStart]->matchIndex; int bodyEnd = mTokenizer[bodyStart]->matchIndex;
if (bodyEnd>=endIndex) { if (bodyEnd>endIndex) {
return; return;
} }
PStatement lambdaBlock = addStatement( PStatement lambdaBlock = addStatement(
@ -3981,7 +3981,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;
@ -3994,8 +3994,8 @@ void CppParser::internalParse(const QString &fileName)
} }
// qDebug()<<"parse"<<timer.elapsed(); // qDebug()<<"parse"<<timer.elapsed();
#ifdef QT_DEBUG #ifdef QT_DEBUG
mStatementList.dumpAll(QString("r:\\all-stats-%1.txt").arg(extractFileName(fileName))); // mStatementList.dumpAll(QString("r:\\all-stats-%1.txt").arg(extractFileName(fileName)));
mStatementList.dump(QString("r:\\stats-%1.txt").arg(extractFileName(fileName))); // mStatementList.dump(QString("r:\\stats-%1.txt").arg(extractFileName(fileName)));
#endif #endif
//reduce memory usage //reduce memory usage
internalClear(); internalClear();