diff --git a/NEWS.md b/NEWS.md index 9f794165..b5cff84d 100644 --- a/NEWS.md +++ b/NEWS.md @@ -41,8 +41,8 @@ Red Panda C++ Version 2.27 - fix: Using alias for global symbols are not correctly handled. - enhancement: Support "enum struct" Scoped enumerations. - fix: Function tips contains functions that not in the scope. - - fix: Hint for bold text () are not correctly handled in the function tips. - + - fix: Hint for bold text () are not correctly handled in the function tips. + - fix: Full scope typed variables in lambda expressions is not correctly parsed. Red Panda C++ Version 2.26 - enhancement: Code suggestion for embedded std::vectors. diff --git a/RedPandaIDE/parser/cppparser.cpp b/RedPandaIDE/parser/cppparser.cpp index feea4c49..4beb3e2c 100644 --- a/RedPandaIDE/parser/cppparser.cpp +++ b/RedPandaIDE/parser/cppparser.cpp @@ -2953,15 +2953,25 @@ void CppParser::handleLambda(int index, int endIndex) scanMethodArgs(lambdaBlock,argStart); addSoloScopeLevel(lambdaBlock,mTokenizer[bodyStart]->line); int i=bodyStart+1; // start after '{'; - while (i+2text) + QString sType; + while (itext=="::") { + sType="::"; + i++; + } + while (i+1text) + && mTokenizer[i+1]->text=="::") { + sType+=mTokenizer[i]->text; + sType+="::"; + i+=2; + } + if (i+1text) && !mTokenizer[i]->text.endsWith('.') && !mTokenizer[i]->text.endsWith("->") && (mTokenizer[i+1]->text.startsWith('*') || mTokenizer[i+1]->text.startsWith('&') || tokenIsTypeOrNonKeyword(mTokenizer[i+1]->text))) { - QString sType; QString sName; while (i+1text==':' @@ -2973,7 +2983,7 @@ void CppParser::handleLambda(int index, int endIndex) ) break; else { - if (!sType.isEmpty()) + if (!sType.isEmpty() && !sType.endsWith("::")) sType+=' '; sType+=mTokenizer[i]->text; } @@ -3038,6 +3048,7 @@ void CppParser::handleLambda(int index, int endIndex) } } i=moveToEndOfStatement(i, true, bodyEnd); + sType=""; } removeScopeLevel(mTokenizer[bodyEnd]->line); }