Skip to content

Commit c3db367

Browse files
authored
[PrintAsObjC] Simplify NSUInteger special case slightly (#27188)
Two conditions are always checked together; just have the caller do it. No functionality change.
1 parent f846cf3 commit c3db367

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/PrintAsObjC/DeclAndTypePrinter.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -407,10 +407,9 @@ class DeclAndTypePrinter::Implementation
407407
void printSingleMethodParam(StringRef selectorPiece,
408408
const ParamDecl *param,
409409
const clang::ParmVarDecl *clangParam,
410-
bool isNSUIntegerSubscript,
411-
bool isLastPiece) {
410+
bool forceNSUInteger) {
412411
os << selectorPiece << ":(";
413-
if ((isNSUIntegerSubscript && isLastPiece) ||
412+
if (forceNSUInteger ||
414413
(clangParam && isNSUInteger(clangParam->getType()))) {
415414
os << "NSUInteger";
416415
} else {
@@ -602,8 +601,9 @@ class DeclAndTypePrinter::Implementation
602601
clangParam = clangMethod->parameters()[paramIndex];
603602

604603
// Single-parameter methods.
604+
bool forceNSUInteger = isNSUIntegerSubscript && (i == n-1);
605605
printSingleMethodParam(piece, params[paramIndex], clangParam,
606-
isNSUIntegerSubscript, i == n-1);
606+
forceNSUInteger);
607607
++paramIndex;
608608
}
609609

0 commit comments

Comments
 (0)