Skip to content

Commit 086a985

Browse files
authored
Merge pull request swiftlang#23369 from rintaro/ide-completetion-outermost-param
[Gardening][CodeCompletion] Remove unused parameter
2 parents 87cf549 + df20597 commit 086a985

File tree

2 files changed

+28
-29
lines changed

2 files changed

+28
-29
lines changed

lib/IDE/CodeCompletion.cpp

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2116,9 +2116,8 @@ class CompletionLookup final : public swift::VisibleDeclConsumer {
21162116
if (NeedComma)
21172117
Builder.addComma();
21182118

2119-
Builder.addCallParameter(argName, bodyName, paramTy, isVariadic,
2120-
/*TopLevel*/ true, isInOut, isIUO,
2121-
isAutoclosure);
2119+
Builder.addCallParameter(argName, bodyName, paramTy, isVariadic, isInOut,
2120+
isIUO, isAutoclosure);
21222121

21232122
modifiedBuilder = true;
21242123
NeedComma = true;
@@ -3235,9 +3234,8 @@ class CompletionLookup final : public swift::VisibleDeclConsumer {
32353234
builder.addWhitespace(" ");
32363235
assert(RHSType && resultType);
32373236
builder.addCallParameter(Identifier(), Identifier(), RHSType,
3238-
/*IsVarArg*/ false, /*TopLevel*/ true,
3239-
/*IsInOut*/ false, /*isIUO*/ false,
3240-
/*isAutoClosure*/ false);
3237+
/*IsVarArg*/ false, /*IsInOut*/ false,
3238+
/*isIUO*/ false, /*isAutoClosure*/ false);
32413239
addTypeAnnotation(builder, resultType);
32423240
}
32433241

@@ -3259,9 +3257,9 @@ class CompletionLookup final : public swift::VisibleDeclConsumer {
32593257
builder.addTextChunk(op->getName().str());
32603258
builder.addWhitespace(" ");
32613259
if (RHSType)
3262-
builder.addCallParameter(Identifier(), Identifier(), RHSType, false, true,
3263-
/*IsInOut*/ false, /*isIUO*/ false,
3264-
/*isAutoClosure*/ false);
3260+
builder.addCallParameter(Identifier(), Identifier(), RHSType,
3261+
/*IsVarArg*/ false, /*IsInOut*/ false,
3262+
/*isIUO*/ false, /*isAutoClosure*/ false);
32653263
if (resultType)
32663264
addTypeAnnotation(builder, resultType);
32673265
}
@@ -3446,21 +3444,21 @@ class CompletionLookup final : public swift::VisibleDeclConsumer {
34463444
addFromProto(LK::ColorLiteral, "", [&](Builder &builder) {
34473445
builder.addTextChunk("#colorLiteral");
34483446
builder.addLeftParen();
3449-
builder.addCallParameter(context.getIdentifier("red"), floatType, false,
3450-
true, /*IsInOut*/ false,
3447+
builder.addCallParameter(context.getIdentifier("red"), floatType,
3448+
/*IsVarArg*/ false, /*IsInOut*/ false,
34513449
/*isIUO*/ false, /*isAutoClosure*/ false);
34523450
builder.addComma();
3453-
builder.addCallParameter(context.getIdentifier("green"), floatType, false,
3454-
true, /*IsInOut*/ false, /*isIUO*/ false,
3455-
/*isAutoClosure*/ false);
3451+
builder.addCallParameter(context.getIdentifier("green"), floatType,
3452+
/*IsVarArg*/ false, /*IsInOut*/ false,
3453+
/*isIUO*/ false, /*isAutoClosure*/ false);
34563454
builder.addComma();
3457-
builder.addCallParameter(context.getIdentifier("blue"), floatType, false,
3458-
true, /*IsInOut*/ false, /*isIUO*/ false,
3459-
/*isAutoClosure*/ false);
3455+
builder.addCallParameter(context.getIdentifier("blue"), floatType,
3456+
/*IsVarArg*/ false, /*IsInOut*/ false,
3457+
/*isIUO*/ false, /*isAutoClosure*/ false);
34603458
builder.addComma();
3461-
builder.addCallParameter(context.getIdentifier("alpha"), floatType, false,
3462-
true, /*IsInOut*/ false, /*isIUO*/ false,
3463-
/*isAutoClosure*/ false);
3459+
builder.addCallParameter(context.getIdentifier("alpha"), floatType,
3460+
/*IsVarArg*/ false, /*IsInOut*/ false,
3461+
/*isIUO*/ false, /*isAutoClosure*/ false);
34643462
builder.addRightParen();
34653463
});
34663464

@@ -3469,8 +3467,9 @@ class CompletionLookup final : public swift::VisibleDeclConsumer {
34693467
builder.addTextChunk("#imageLiteral");
34703468
builder.addLeftParen();
34713469
builder.addCallParameter(context.getIdentifier("resourceName"),
3472-
stringType, false, true, /*IsInOut*/ false,
3473-
/*isIUO*/ false, /*isAutoClosure*/ false);
3470+
stringType, /*IsVarArg*/ false,
3471+
/*IsInOut*/ false, /*isIUO*/ false,
3472+
/*isAutoClosure*/ false);
34743473
builder.addRightParen();
34753474
});
34763475

lib/IDE/CodeCompletionResultBuilder.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ class CodeCompletionResultBuilder {
315315
}
316316

317317
void addCallParameter(Identifier Name, Identifier LocalName, Type Ty,
318-
bool IsVarArg, bool Outermost, bool IsInOut, bool IsIUO,
318+
bool IsVarArg, bool IsInOut, bool IsIUO,
319319
bool isAutoClosure) {
320320
CurrentNestingLevel++;
321321

@@ -325,15 +325,15 @@ class CodeCompletionResultBuilder {
325325
llvm::SmallString<16> EscapedKeyword;
326326
addChunkWithText(
327327
CodeCompletionString::Chunk::ChunkKind::CallParameterName,
328-
escapeArgumentLabel(Name.str(), !Outermost, EscapedKeyword));
328+
escapeArgumentLabel(Name.str(), false, EscapedKeyword));
329329
addChunkWithTextNoCopy(
330330
CodeCompletionString::Chunk::ChunkKind::CallParameterColon, ": ");
331331
} else if (!LocalName.empty()) {
332332
// Use local (non-API) parameter name if we have nothing else.
333333
llvm::SmallString<16> EscapedKeyword;
334334
addChunkWithText(
335335
CodeCompletionString::Chunk::ChunkKind::CallParameterInternalName,
336-
escapeArgumentLabel(LocalName.str(), !Outermost, EscapedKeyword));
336+
escapeArgumentLabel(LocalName.str(), false, EscapedKeyword));
337337
addChunkWithTextNoCopy(
338338
CodeCompletionString::Chunk::ChunkKind::CallParameterColon, ": ");
339339
}
@@ -376,10 +376,10 @@ class CodeCompletionResultBuilder {
376376
CurrentNestingLevel--;
377377
}
378378

379-
void addCallParameter(Identifier Name, Type Ty, bool IsVarArg, bool Outermost,
380-
bool IsInOut, bool IsIUO, bool isAutoClosure) {
381-
addCallParameter(Name, Identifier(), Ty, IsVarArg, Outermost, IsInOut,
382-
IsIUO, isAutoClosure);
379+
void addCallParameter(Identifier Name, Type Ty, bool IsVarArg, bool IsInOut,
380+
bool IsIUO, bool isAutoClosure) {
381+
addCallParameter(Name, Identifier(), Ty, IsVarArg, IsInOut, IsIUO,
382+
isAutoClosure);
383383
}
384384

385385
void addGenericParameter(StringRef Name) {

0 commit comments

Comments
 (0)