diff --git a/NEWS.md b/NEWS.md index 9f773432..860422f0 100644 --- a/NEWS.md +++ b/NEWS.md @@ -62,6 +62,7 @@ Red Panda C++ Version 2.27 - change: Invert scroll direction in horizontal, like in vertical. - enhancement: Show type completion info after 'const' and 'volatile' - fix: Caret unseen when move to a long line end by press END. + - fix: Can't correctly retrieve function parameters type. 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 a9bb2913..09b37b66 100644 --- a/RedPandaIDE/parser/cppparser.cpp +++ b/RedPandaIDE/parser/cppparser.cpp @@ -6150,15 +6150,27 @@ void CppParser::scanMethodArgs(const PStatement& functionStatement, int argStart addMethodParameterStatement(words,mTokenizer[i]->line,functionStatement); i=skipAssignment(i,argEnd); } else if (mTokenizer[i]->text=="::") { - words.append(mTokenizer[i]->text); + int lastIdx=words.count()-1; + if (lastIdx>=0 && words[lastIdx]!="const") { + words[lastIdx]=words[lastIdx]+mTokenizer[i]->text; + } else + words.append(mTokenizer[i]->text); i++; } else if (mTokenizer[i]->text==',') { addMethodParameterStatement(words,mTokenizer[i]->line,functionStatement); i++; words.clear(); + } else if (isIdentChar(mTokenizer[i]->text[0])) { + // identifier + int lastIdx=words.count()-1; + if (lastIdx>=0 && words[lastIdx].endsWith("::")) { + words[lastIdx]=words[lastIdx]+mTokenizer[i]->text; + } else + words.append(mTokenizer[i]->text); + i++; } else if (isWordChar(mTokenizer[i]->text[0])) { - QString cmd=mTokenizer[i]->text; - words.append(cmd); + // * & + words.append(mTokenizer[i]->text); i++; } else if (mTokenizer[i]->text.startsWith("[")) { if (!words.isEmpty()) {