@@ -411,18 +411,18 @@ void CodeCompletionString::print(raw_ostream &OS) const {
411
411
case ChunkKind::TypeIdUser:
412
412
AnnotatedTextChunk = I->isAnnotation ();
413
413
LLVM_FALLTHROUGH;
414
- case ChunkKind::CallParameterName :
415
- case ChunkKind::CallParameterInternalName :
416
- case ChunkKind::CallParameterColon :
414
+ case ChunkKind::CallArgumentName :
415
+ case ChunkKind::CallArgumentInternalName :
416
+ case ChunkKind::CallArgumentColon :
417
417
case ChunkKind::DeclAttrParamColon:
418
- case ChunkKind::CallParameterType :
419
- case ChunkKind::CallParameterClosureType :
418
+ case ChunkKind::CallArgumentType :
419
+ case ChunkKind::CallArgumentClosureType :
420
420
case ChunkKind::GenericParameterName:
421
421
if (AnnotatedTextChunk)
422
422
OS << " ['" ;
423
- else if (I->getKind () == ChunkKind::CallParameterInternalName )
423
+ else if (I->getKind () == ChunkKind::CallArgumentInternalName )
424
424
OS << " (" ;
425
- else if (I->getKind () == ChunkKind::CallParameterClosureType )
425
+ else if (I->getKind () == ChunkKind::CallArgumentClosureType )
426
426
OS << " ##" ;
427
427
for (char Ch : I->getText ()) {
428
428
if (Ch == ' \n ' )
@@ -432,12 +432,12 @@ void CodeCompletionString::print(raw_ostream &OS) const {
432
432
}
433
433
if (AnnotatedTextChunk)
434
434
OS << " ']" ;
435
- else if (I->getKind () == ChunkKind::CallParameterInternalName )
435
+ else if (I->getKind () == ChunkKind::CallArgumentInternalName )
436
436
OS << " )" ;
437
437
break ;
438
438
case ChunkKind::OptionalBegin:
439
- case ChunkKind::CallParameterBegin :
440
- case ChunkKind::CallParameterTypeBegin :
439
+ case ChunkKind::CallArgumentBegin :
440
+ case ChunkKind::CallArgumentTypeBegin :
441
441
case ChunkKind::GenericParameterBegin:
442
442
OS << " {#" ;
443
443
break ;
@@ -461,7 +461,7 @@ void CodeCompletionString::print(raw_ostream &OS) const {
461
461
OS << I->getText ();
462
462
OS << " #]" ;
463
463
break ;
464
- case ChunkKind::CallParameterClosureExpr :
464
+ case ChunkKind::CallArgumentClosureExpr :
465
465
OS << " {" << I->getText () << " |}" ;
466
466
break ;
467
467
case ChunkKind::BraceStmtWithCursor:
@@ -924,69 +924,63 @@ class AnnotatedTypePrinter : public ASTPrinter {
924
924
};
925
925
} // namespcae
926
926
927
- void CodeCompletionResultBuilder::addCallParameter (Identifier Name,
928
- Identifier LocalName,
929
- Type Ty,
930
- Type ContextTy,
931
- bool IsVarArg,
932
- bool IsInOut,
933
- bool IsIUO,
934
- bool isAutoClosure,
935
- bool useUnderscoreLabel,
936
- bool isLabeledTrailingClosure) {
927
+ void CodeCompletionResultBuilder::addCallArgument (
928
+ Identifier Name, Identifier LocalName, Type Ty, Type ContextTy,
929
+ bool IsVarArg, bool IsInOut, bool IsIUO, bool isAutoClosure,
930
+ bool useUnderscoreLabel, bool isLabeledTrailingClosure) {
937
931
++CurrentNestingLevel;
938
932
using ChunkKind = CodeCompletionString::Chunk::ChunkKind;
939
933
940
- addSimpleChunk (ChunkKind::CallParameterBegin );
934
+ addSimpleChunk (ChunkKind::CallArgumentBegin );
941
935
942
936
if (shouldAnnotateResults ()) {
943
937
if (!Name.empty () || !LocalName.empty ()) {
944
938
llvm::SmallString<16 > EscapedKeyword;
945
939
946
940
if (!Name.empty ()) {
947
941
addChunkWithText (
948
- CodeCompletionString::Chunk::ChunkKind::CallParameterName ,
942
+ CodeCompletionString::Chunk::ChunkKind::CallArgumentName ,
949
943
escapeKeyword (Name.str (), false , EscapedKeyword));
950
944
951
945
if (!LocalName.empty () && Name != LocalName) {
952
946
addChunkWithTextNoCopy (ChunkKind::Text, " " );
953
947
getLastChunk ().setIsAnnotation ();
954
- addChunkWithText (ChunkKind::CallParameterInternalName ,
948
+ addChunkWithText (ChunkKind::CallArgumentInternalName ,
955
949
escapeKeyword (LocalName.str (), false , EscapedKeyword));
956
950
getLastChunk ().setIsAnnotation ();
957
951
}
958
952
} else {
959
953
assert (!LocalName.empty ());
960
- addChunkWithTextNoCopy (ChunkKind::CallParameterName , " _" );
954
+ addChunkWithTextNoCopy (ChunkKind::CallArgumentName , " _" );
961
955
getLastChunk ().setIsAnnotation ();
962
956
addChunkWithTextNoCopy (ChunkKind::Text, " " );
963
957
getLastChunk ().setIsAnnotation ();
964
- addChunkWithText (ChunkKind::CallParameterInternalName ,
958
+ addChunkWithText (ChunkKind::CallArgumentInternalName ,
965
959
escapeKeyword (LocalName.str (), false , EscapedKeyword));
966
960
}
967
- addChunkWithTextNoCopy (ChunkKind::CallParameterColon , " : " );
961
+ addChunkWithTextNoCopy (ChunkKind::CallArgumentColon , " : " );
968
962
}
969
963
} else {
970
964
if (!Name.empty ()) {
971
965
llvm::SmallString<16 > EscapedKeyword;
972
966
addChunkWithText (
973
- CodeCompletionString::Chunk::ChunkKind::CallParameterName ,
967
+ CodeCompletionString::Chunk::ChunkKind::CallArgumentName ,
974
968
escapeKeyword (Name.str (), false , EscapedKeyword));
975
969
addChunkWithTextNoCopy (
976
- CodeCompletionString::Chunk::ChunkKind::CallParameterColon , " : " );
970
+ CodeCompletionString::Chunk::ChunkKind::CallArgumentColon , " : " );
977
971
} else if (useUnderscoreLabel) {
978
972
addChunkWithTextNoCopy (
979
- CodeCompletionString::Chunk::ChunkKind::CallParameterName , " _" );
973
+ CodeCompletionString::Chunk::ChunkKind::CallArgumentName , " _" );
980
974
addChunkWithTextNoCopy (
981
- CodeCompletionString::Chunk::ChunkKind::CallParameterColon , " : " );
975
+ CodeCompletionString::Chunk::ChunkKind::CallArgumentColon , " : " );
982
976
} else if (!LocalName.empty ()) {
983
977
// Use local (non-API) parameter name if we have nothing else.
984
978
llvm::SmallString<16 > EscapedKeyword;
985
979
addChunkWithText (
986
- CodeCompletionString::Chunk::ChunkKind::CallParameterInternalName ,
980
+ CodeCompletionString::Chunk::ChunkKind::CallArgumentInternalName ,
987
981
escapeKeyword (LocalName.str (), false , EscapedKeyword));
988
982
addChunkWithTextNoCopy (
989
- CodeCompletionString::Chunk::ChunkKind::CallParameterColon , " : " );
983
+ CodeCompletionString::Chunk::ChunkKind::CallArgumentColon , " : " );
990
984
}
991
985
}
992
986
@@ -1014,13 +1008,13 @@ void CodeCompletionResultBuilder::addCallParameter(Identifier Name,
1014
1008
if (ContextTy)
1015
1009
PO.setBaseType (ContextTy);
1016
1010
if (shouldAnnotateResults ()) {
1017
- withNestedGroup (ChunkKind::CallParameterTypeBegin , [&]() {
1011
+ withNestedGroup (ChunkKind::CallArgumentTypeBegin , [&]() {
1018
1012
AnnotatedTypePrinter printer (*this );
1019
1013
Ty->print (printer, PO);
1020
1014
});
1021
1015
} else {
1022
1016
std::string TypeName = Ty->getString (PO);
1023
- addChunkWithText (ChunkKind::CallParameterType , TypeName);
1017
+ addChunkWithText (ChunkKind::CallArgumentType , TypeName);
1024
1018
}
1025
1019
1026
1020
// Look through optional types and type aliases to find out if we have
@@ -1069,12 +1063,12 @@ void CodeCompletionResultBuilder::addCallParameter(Identifier Name,
1069
1063
OS << " in" ;
1070
1064
1071
1065
addChunkWithText (
1072
- CodeCompletionString::Chunk::ChunkKind::CallParameterClosureExpr ,
1066
+ CodeCompletionString::Chunk::ChunkKind::CallArgumentClosureExpr ,
1073
1067
OS.str ());
1074
1068
} else {
1075
1069
// Add the closure type.
1076
1070
addChunkWithText (
1077
- CodeCompletionString::Chunk::ChunkKind::CallParameterClosureType ,
1071
+ CodeCompletionString::Chunk::ChunkKind::CallArgumentClosureType ,
1078
1072
AFT->getString (PO));
1079
1073
}
1080
1074
}
@@ -1381,8 +1375,8 @@ Optional<unsigned> CodeCompletionString::getFirstTextChunkIndex(
1381
1375
switch (C.getKind ()) {
1382
1376
using ChunkKind = Chunk::ChunkKind;
1383
1377
case ChunkKind::Text:
1384
- case ChunkKind::CallParameterName :
1385
- case ChunkKind::CallParameterInternalName :
1378
+ case ChunkKind::CallArgumentName :
1379
+ case ChunkKind::CallArgumentInternalName :
1386
1380
case ChunkKind::GenericParameterName:
1387
1381
case ChunkKind::LeftParen:
1388
1382
case ChunkKind::LeftBracket:
@@ -1394,7 +1388,7 @@ Optional<unsigned> CodeCompletionString::getFirstTextChunkIndex(
1394
1388
case ChunkKind::BaseName:
1395
1389
case ChunkKind::TypeIdSystem:
1396
1390
case ChunkKind::TypeIdUser:
1397
- case ChunkKind::CallParameterBegin :
1391
+ case ChunkKind::CallArgumentBegin :
1398
1392
return i;
1399
1393
case ChunkKind::Dot:
1400
1394
case ChunkKind::ExclamationMark:
@@ -1414,12 +1408,12 @@ Optional<unsigned> CodeCompletionString::getFirstTextChunkIndex(
1414
1408
case ChunkKind::OverrideKeyword:
1415
1409
case ChunkKind::EffectsSpecifierKeyword:
1416
1410
case ChunkKind::DeclIntroducer:
1417
- case ChunkKind::CallParameterColon :
1418
- case ChunkKind::CallParameterTypeBegin :
1411
+ case ChunkKind::CallArgumentColon :
1412
+ case ChunkKind::CallArgumentTypeBegin :
1419
1413
case ChunkKind::DeclAttrParamColon:
1420
- case ChunkKind::CallParameterType :
1421
- case ChunkKind::CallParameterClosureType :
1422
- case ChunkKind::CallParameterClosureExpr :
1414
+ case ChunkKind::CallArgumentType :
1415
+ case ChunkKind::CallArgumentClosureType :
1416
+ case ChunkKind::CallArgumentClosureExpr :
1423
1417
case ChunkKind::OptionalBegin:
1424
1418
case ChunkKind::GenericParameterBegin:
1425
1419
case ChunkKind::DynamicLookupMethodCallTail:
@@ -2810,11 +2804,11 @@ class CompletionLookup final : public swift::VisibleDeclConsumer {
2810
2804
if (auto typeContext = CurrDeclContext->getInnermostTypeContext ())
2811
2805
contextTy = typeContext->getDeclaredTypeInContext ();
2812
2806
2813
- Builder.addCallParameter (argName, bodyName,
2814
- eraseArchetypes (paramTy, genericSig), contextTy,
2815
- isVariadic, isInOut, isIUO, isAutoclosure,
2816
- /* useUnderscoreLabel=*/ false ,
2817
- /* isLabeledTrailingClosure=*/ false );
2807
+ Builder.addCallArgument (argName, bodyName,
2808
+ eraseArchetypes (paramTy, genericSig), contextTy,
2809
+ isVariadic, isInOut, isIUO, isAutoclosure,
2810
+ /* useUnderscoreLabel=*/ false ,
2811
+ /* isLabeledTrailingClosure=*/ false );
2818
2812
2819
2813
modifiedBuilder = true ;
2820
2814
NeedComma = true ;
@@ -4192,7 +4186,7 @@ class CompletionLookup final : public swift::VisibleDeclConsumer {
4192
4186
Type contextTy;
4193
4187
if (auto typeContext = CurrDeclContext->getInnermostTypeContext ())
4194
4188
contextTy = typeContext->getDeclaredTypeInContext ();
4195
- builder.addCallParameter (Identifier (), RHSType, contextTy);
4189
+ builder.addCallArgument (Identifier (), RHSType, contextTy);
4196
4190
addTypeAnnotation (builder, resultType);
4197
4191
}
4198
4192
@@ -4217,7 +4211,7 @@ class CompletionLookup final : public swift::VisibleDeclConsumer {
4217
4211
Type contextTy;
4218
4212
if (auto typeContext = CurrDeclContext->getInnermostTypeContext ())
4219
4213
contextTy = typeContext->getDeclaredTypeInContext ();
4220
- builder.addCallParameter (Identifier (), RHSType, contextTy);
4214
+ builder.addCallArgument (Identifier (), RHSType, contextTy);
4221
4215
}
4222
4216
if (resultType)
4223
4217
addTypeAnnotation (builder, resultType);
@@ -4476,21 +4470,21 @@ class CompletionLookup final : public swift::VisibleDeclConsumer {
4476
4470
addFromProto (LK::ColorLiteral, [&](Builder &builder) {
4477
4471
builder.addBaseName (" #colorLiteral" );
4478
4472
builder.addLeftParen ();
4479
- builder.addCallParameter (context.getIdentifier (" red" ), floatType);
4473
+ builder.addCallArgument (context.getIdentifier (" red" ), floatType);
4480
4474
builder.addComma ();
4481
- builder.addCallParameter (context.getIdentifier (" green" ), floatType);
4475
+ builder.addCallArgument (context.getIdentifier (" green" ), floatType);
4482
4476
builder.addComma ();
4483
- builder.addCallParameter (context.getIdentifier (" blue" ), floatType);
4477
+ builder.addCallArgument (context.getIdentifier (" blue" ), floatType);
4484
4478
builder.addComma ();
4485
- builder.addCallParameter (context.getIdentifier (" alpha" ), floatType);
4479
+ builder.addCallArgument (context.getIdentifier (" alpha" ), floatType);
4486
4480
builder.addRightParen ();
4487
4481
});
4488
4482
4489
4483
auto stringType = context.getStringType ();
4490
4484
addFromProto (LK::ImageLiteral, [&](Builder &builder) {
4491
4485
builder.addBaseName (" #imageLiteral" );
4492
4486
builder.addLeftParen ();
4493
- builder.addCallParameter (context.getIdentifier (" resourceName" ),
4487
+ builder.addCallArgument (context.getIdentifier (" resourceName" ),
4494
4488
stringType);
4495
4489
builder.addRightParen ();
4496
4490
});
@@ -4690,12 +4684,12 @@ class CompletionLookup final : public swift::VisibleDeclConsumer {
4690
4684
// FIXME: SemanticContextKind::Local is not correct.
4691
4685
// Use 'None' (and fix prioritization) or introduce a new context.
4692
4686
SemanticContextKind::Local, {});
4693
- Builder.addCallParameter (Arg->getLabel (), Identifier (),
4694
- Arg->getPlainType (), ContextType,
4695
- Arg->isVariadic (), Arg->isInOut (),
4696
- /* isIUO=*/ false , Arg->isAutoClosure (),
4697
- /* useUnderscoreLabel=*/ true ,
4698
- isLabeledTrailingClosure);
4687
+ Builder.addCallArgument (Arg->getLabel (), Identifier (),
4688
+ Arg->getPlainType (), ContextType,
4689
+ Arg->isVariadic (), Arg->isInOut (),
4690
+ /* isIUO=*/ false , Arg->isAutoClosure (),
4691
+ /* useUnderscoreLabel=*/ true ,
4692
+ isLabeledTrailingClosure);
4699
4693
Builder.addFlair (CodeCompletionFlairBit::ArgumentLabels);
4700
4694
auto Ty = Arg->getPlainType ();
4701
4695
if (Arg->isInOut ()) {
0 commit comments