- fix: Function parameters that is pointer,reference or array can't be correctly parsed.
This commit is contained in:
parent
5f75fd97cd
commit
9a5f97cc7a
1
NEWS.md
1
NEWS.md
|
@ -23,6 +23,7 @@ Red Panda C++ Version 2.8
|
||||||
- fix: alt+shift+left/right can't select
|
- fix: alt+shift+left/right can't select
|
||||||
- fix: Input any content will exit column mode.
|
- fix: Input any content will exit column mode.
|
||||||
- fix: Result of scope calculation not right if a for statement immediately follows another for statement.
|
- fix: Result of scope calculation not right if a for statement immediately follows another for statement.
|
||||||
|
- fix: Function parameters that is pointer,reference or array can't be correctly parsed.
|
||||||
|
|
||||||
Red Panda C++ Version 2.7
|
Red Panda C++ Version 2.7
|
||||||
|
|
||||||
|
|
|
@ -3819,7 +3819,7 @@ void CppParser::internalParse(const QString &fileName)
|
||||||
|
|
||||||
QStringList preprocessResult = mPreprocessor.result();
|
QStringList preprocessResult = mPreprocessor.result();
|
||||||
#ifdef QT_DEBUG
|
#ifdef QT_DEBUG
|
||||||
// stringsToFile(mPreprocessor.result(),QString("r:\\preprocess-%1.txt").arg(extractFileName(fileName)));
|
stringsToFile(mPreprocessor.result(),QString("r:\\preprocess-%1.txt").arg(extractFileName(fileName)));
|
||||||
// mPreprocessor.dumpDefinesTo("r:\\defines.txt");
|
// mPreprocessor.dumpDefinesTo("r:\\defines.txt");
|
||||||
// mPreprocessor.dumpIncludesListTo("r:\\includes.txt");
|
// mPreprocessor.dumpIncludesListTo("r:\\includes.txt");
|
||||||
#endif
|
#endif
|
||||||
|
@ -3833,7 +3833,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
|
||||||
lastIndex = -1;
|
lastIndex = -1;
|
||||||
|
@ -3844,8 +3844,8 @@ void CppParser::internalParse(const QString &fileName)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#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();
|
||||||
|
@ -5116,30 +5116,25 @@ void CppParser::scanMethodArgs(const PStatement& functionStatement, int argStart
|
||||||
} else if (isWordChar(mTokenizer[i]->text[0])) {
|
} else if (isWordChar(mTokenizer[i]->text[0])) {
|
||||||
QString cmd=mTokenizer[i]->text;
|
QString cmd=mTokenizer[i]->text;
|
||||||
if (i+1==argEnd || mTokenizer[i+1]->text==',' || mTokenizer[i+1]->text=='=') {
|
if (i+1==argEnd || mTokenizer[i+1]->text==',' || mTokenizer[i+1]->text=='=') {
|
||||||
bool noCmd=false;
|
QString args,suffix;
|
||||||
if (!cmd.startsWith('*')
|
parseCommandTypeAndArgs(cmd,suffix,args);
|
||||||
&& !cmd.startsWith('&')
|
if (!cmd.isEmpty()) {
|
||||||
&& !cmd.endsWith(']')) {
|
PStatement statement = findStatementOf(mCurrentFile,cmd,functionStatement,true);
|
||||||
PStatement statement=findStatementOf(mCurrentFile,cmd,functionStatement,true);
|
bool noCmd = (statement && isTypeStatement(statement->kind));
|
||||||
noCmd = (statement && isTypeStatement(statement->kind));
|
|
||||||
if (!noCmd) {
|
if (!noCmd) {
|
||||||
QString args,suffix;
|
addStatement(
|
||||||
parseCommandTypeAndArgs(cmd,suffix,args);
|
functionStatement,
|
||||||
if (!cmd.isEmpty()) {
|
mCurrentFile,
|
||||||
addStatement(
|
varType+suffix, // 'int*'
|
||||||
functionStatement,
|
cmd, // a
|
||||||
mCurrentFile,
|
args,
|
||||||
varType+suffix, // 'int*'
|
"",
|
||||||
cmd, // a
|
"",
|
||||||
args,
|
mTokenizer[i]->line,
|
||||||
"",
|
StatementKind::skParameter,
|
||||||
"",
|
StatementScope::Local,
|
||||||
mTokenizer[i]->line,
|
StatementClassScope::None,
|
||||||
StatementKind::skParameter,
|
StatementProperty::spHasDefinition);
|
||||||
StatementScope::Local,
|
|
||||||
StatementClassScope::None,
|
|
||||||
StatementProperty::spHasDefinition);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -5495,7 +5495,7 @@ void SynEdit::doInsertText(const BufferCoord& pos,
|
||||||
ensureCursorPosVisible();
|
ensureCursorPosVisible();
|
||||||
break;
|
break;
|
||||||
case SelectionMode::Column:
|
case SelectionMode::Column:
|
||||||
insertedLines = doInsertTextByColumnMode(pos,text, startLine,endLine);
|
insertedLines = doInsertTextByColumnMode(text, startLine,endLine);
|
||||||
doLinesInserted(endLine-insertedLines+1,insertedLines);
|
doLinesInserted(endLine-insertedLines+1,insertedLines);
|
||||||
if (!text.isEmpty()) {
|
if (!text.isEmpty()) {
|
||||||
int textLen = text.back().length();
|
int textLen = text.back().length();
|
||||||
|
@ -5612,7 +5612,7 @@ int SynEdit::doInsertTextByNormalMode(const BufferCoord& pos, const QStringList&
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SynEdit::doInsertTextByColumnMode(const BufferCoord& pos, const QStringList& text, int startLine, int endLine)
|
int SynEdit::doInsertTextByColumnMode(const QStringList& text, int startLine, int endLine)
|
||||||
{
|
{
|
||||||
QString str;
|
QString str;
|
||||||
QString tempString;
|
QString tempString;
|
||||||
|
|
|
@ -550,7 +550,7 @@ private:
|
||||||
void doDeleteText(BufferCoord startPos, BufferCoord endPos, SelectionMode mode);
|
void doDeleteText(BufferCoord startPos, BufferCoord endPos, SelectionMode mode);
|
||||||
void doInsertText(const BufferCoord& pos, const QStringList& text, SelectionMode mode, int startLine, int endLine);
|
void doInsertText(const BufferCoord& pos, const QStringList& text, SelectionMode mode, int startLine, int endLine);
|
||||||
int doInsertTextByNormalMode(const BufferCoord& pos, const QStringList& text, BufferCoord &newPos);
|
int doInsertTextByNormalMode(const BufferCoord& pos, const QStringList& text, BufferCoord &newPos);
|
||||||
int doInsertTextByColumnMode(const BufferCoord& pos, const QStringList& text, int startLine, int endLine);
|
int doInsertTextByColumnMode(const QStringList& text, int startLine, int endLine);
|
||||||
int doInsertTextByLineMode(const BufferCoord& pos, const QStringList& text, BufferCoord &newPos);
|
int doInsertTextByLineMode(const BufferCoord& pos, const QStringList& text, BufferCoord &newPos);
|
||||||
|
|
||||||
void doTrimTrailingSpaces();
|
void doTrimTrailingSpaces();
|
||||||
|
|
Loading…
Reference in New Issue