- fix: Can't correctly retrieve function parameters type.

This commit is contained in:
Roy Qu 2024-03-21 16:18:14 +08:00
parent d054d9ffce
commit c407c27a7a
2 changed files with 16 additions and 3 deletions

View File

@ -62,6 +62,7 @@ Red Panda C++ Version 2.27
- change: Invert scroll direction in horizontal, like in vertical. - change: Invert scroll direction in horizontal, like in vertical.
- enhancement: Show type completion info after 'const' and 'volatile' - enhancement: Show type completion info after 'const' and 'volatile'
- fix: Caret unseen when move to a long line end by press END. - 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 Red Panda C++ Version 2.26
- enhancement: Code suggestion for embedded std::vectors. - enhancement: Code suggestion for embedded std::vectors.

View File

@ -6150,15 +6150,27 @@ void CppParser::scanMethodArgs(const PStatement& functionStatement, int argStart
addMethodParameterStatement(words,mTokenizer[i]->line,functionStatement); addMethodParameterStatement(words,mTokenizer[i]->line,functionStatement);
i=skipAssignment(i,argEnd); i=skipAssignment(i,argEnd);
} else if (mTokenizer[i]->text=="::") { } else if (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); words.append(mTokenizer[i]->text);
i++; i++;
} else if (mTokenizer[i]->text==',') { } else if (mTokenizer[i]->text==',') {
addMethodParameterStatement(words,mTokenizer[i]->line,functionStatement); addMethodParameterStatement(words,mTokenizer[i]->line,functionStatement);
i++; i++;
words.clear(); 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])) { } else if (isWordChar(mTokenizer[i]->text[0])) {
QString cmd=mTokenizer[i]->text; // * &
words.append(cmd); words.append(mTokenizer[i]->text);
i++; i++;
} else if (mTokenizer[i]->text.startsWith("[")) { } else if (mTokenizer[i]->text.startsWith("[")) {
if (!words.isEmpty()) { if (!words.isEmpty()) {