fix: Value of noname enum members are not shown in the class browser.
This commit is contained in:
parent
6a06b5b3d6
commit
d1214e3d63
|
@ -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 (mIndex<tokenCount) {
|
||||
bool ok;
|
||||
int endIndex = indexOfNextPeriodOrSemicolon(mIndex);
|
||||
value = evaluateConstExpr(endIndex,ok);
|
||||
if (!ok) {
|
||||
canCalcValue=false;
|
||||
}
|
||||
value = evaluateConstExpr(endIndex,canCalcValue);
|
||||
mIndex = endIndex - 1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -154,13 +154,14 @@ QVariant ClassBrowserModel::data(const QModelIndex &index, int role) const
|
|||
|| (node->statement->kind == StatementKind::skTypedef)
|
||||
) {
|
||||
return node->statement->command + node->statement->args + " : " + node->statement->type;
|
||||
} else if (node->statement->kind == StatementKind::skEnum) {
|
||||
}
|
||||
}
|
||||
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) {
|
||||
|
|
Loading…
Reference in New Issue