- fix: crash when eval statements like "fsm::stack fsm;"

This commit is contained in:
Roy Qu 2022-04-17 19:49:04 +08:00
parent 390c403503
commit 312d282501
3 changed files with 11 additions and 3 deletions

View File

@ -10,6 +10,8 @@ Red Panda C++ Version 1.0.4
- enhancement: prefer local headers over system headers when complete #include header path
- fix: tab/shift+tab not correctly handled in options dialog's code template page
- enhancement: batch set cases ( in problem case table's context menu )
- enhancement: add Portugese translation
- fix: crash when eval statements like "fsm::stack fsm;"
Red Panda C++ Version 1.0.3
- fix: when oj problem grabbed by competitive companion received,

View File

@ -350,6 +350,10 @@ PStatement CppParser::findStatementOf(const QString &fileName,
QString typeName;
PStatement typeStatement;
while (!memberName.isEmpty()) {
if (statement->kind!=StatementKind::skClass
&& operatorToken == "::") {
return PStatement();
}
if (statement->kind == StatementKind::skVariable
|| statement->kind == StatementKind::skParameter
|| statement->kind == StatementKind::skFunction) {
@ -544,6 +548,7 @@ PStatement CppParser::findTypeDefinitionOf(const QString &fileName, const QStrin
if (mParsing)
return PStatement();
// Remove pointer stuff from type
QString s = aType; // 'Type' is a keyword
int position = s.length()-1;
@ -4369,7 +4374,8 @@ void CppParser::scanMethodArgs(const PStatement& functionStatement, const QStrin
}
}
QString CppParser::splitPhrase(const QString &phrase, QString &sClazz, QString &sMember, QString &sOperator)
QString CppParser::splitPhrase(const QString &phrase, QString &sClazz,
QString &sOperator, QString &sMember)
{
sClazz="";
sMember="";

View File

@ -404,8 +404,8 @@ private:
void scanMethodArgs(
const PStatement& functionStatement,
const QString& argStr);
QString splitPhrase(const QString& phrase, QString& sClazz, QString &sMember,
QString& sOperator);
QString splitPhrase(const QString& phrase, QString& sClazz,
QString& sOperator, QString &sMember);
QString removeArgNames(const QString& args);