- Fix: Expression that starts with full scoped variables might be treated as var definition.

This commit is contained in:
Roy Qu 2024-02-20 12:34:02 +08:00
parent f0c01e03aa
commit d8e4c4d76b
2 changed files with 7 additions and 1 deletions

View File

@ -43,6 +43,7 @@ Red Panda C++ Version 2.26
- Enhancement: add Windows arm64 package. - Enhancement: add Windows arm64 package.
- Fix: Force to use debug server when debugging with lldb-mi to fix input/output on Windows. - Fix: Force to use debug server when debugging with lldb-mi to fix input/output on Windows.
- Fix: Can't goto definition/declaration into files that not saved. - Fix: Can't goto definition/declaration into files that not saved.
- Fix: Expression that starts with full scoped variables might be treated as var definition.
Red Panda C++ Version 2.25 Red Panda C++ Version 2.25

View File

@ -2340,6 +2340,10 @@ void CppParser::checkAndHandleMethodOrVar(KeywordType keywordType)
mIndex++; mIndex++;
} else { } else {
QString s = mTokenizer[mIndex]->text; QString s = mTokenizer[mIndex]->text;
if (!isWordChar(s.front())) {
mIndex = indexOfNextPeriodOrSemicolon(mIndex);
return;
}
if (sName.endsWith("::")) { if (sName.endsWith("::")) {
sName+=s; sName+=s;
} else { } else {
@ -4444,7 +4448,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;
@ -6305,6 +6309,7 @@ int CppParser::indexOfNextPeriodOrSemicolon(int index, int endIndex)
case ';': case ';':
case ',': case ',':
case '}': case '}':
case ')':
return index; return index;
case '(': case '(':
index = mTokenizer[index]->matchIndex+1; index = mTokenizer[index]->matchIndex+1;