From d1214e3d63e5fcedc0a3cd37a7e9e9f75f58e272 Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Mon, 7 Aug 2023 14:42:42 +0800 Subject: [PATCH] fix: Value of noname enum members are not shown in the class browser. --- RedPandaIDE/parser/cppparser.cpp | 21 +-------------------- RedPandaIDE/widgets/classbrowser.cpp | 11 ++++++----- 2 files changed, 7 insertions(+), 25 deletions(-) diff --git a/RedPandaIDE/parser/cppparser.cpp b/RedPandaIDE/parser/cppparser.cpp index cb2ddd40..03fba771 100644 --- a/RedPandaIDE/parser/cppparser.cpp +++ b/RedPandaIDE/parser/cppparser.cpp @@ -1877,21 +1877,6 @@ int CppParser::evaluateConstExprTerm(int endIndex, bool &ok) if (statement->kind == StatementKind::skEnum) { result = statement->value.toInt(&ok); break; - } else if (statement->kind == StatementKind::skPreprocessor) { - if (!statement->args.isEmpty()) { - ok=false; - return result; - } - QString macroText = statement->value; - if (macroText.isEmpty()) { - ok=false; - return result; - } - if (isDigitChar(macroText[0])) { - result = evaluateLiteralNumber(endIndex,ok); - } else { - s = macroText; - } } } } else { @@ -2687,12 +2672,8 @@ void CppParser::handleEnum(bool isTypedef) mTokenizer[mIndex+1]->text=="=") { mIndex+=2; if (mIndexstatement->kind == StatementKind::skTypedef) ) { return node->statement->command + node->statement->args + " : " + node->statement->type; - } else if (node->statement->kind == StatementKind::skEnum) { - if (!node->statement->value.isEmpty()) - return node->statement->command + node->statement->args + QString("(%1)").arg(node->statement->value); - else - return node->statement->command; } } + if (node->statement->kind == StatementKind::skEnum) { + if (!node->statement->value.isEmpty()) + return node->statement->command + node->statement->args + QString("(%1)").arg(node->statement->value); + else + return node->statement->command; + } return node->statement->command + node->statement->args; } } else if (role == Qt::ForegroundRole) {