@@ -411,18 +411,18 @@ void CodeCompletionString::print(raw_ostream &OS) const {
411411 case ChunkKind::TypeIdUser:
412412 AnnotatedTextChunk = I->isAnnotation ();
413413 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 :
417417 case ChunkKind::DeclAttrParamColon:
418- case ChunkKind::CallParameterType :
419- case ChunkKind::CallParameterClosureType :
418+ case ChunkKind::CallArgumentType :
419+ case ChunkKind::CallArgumentClosureType :
420420 case ChunkKind::GenericParameterName:
421421 if (AnnotatedTextChunk)
422422 OS << " ['" ;
423- else if (I->getKind () == ChunkKind::CallParameterInternalName )
423+ else if (I->getKind () == ChunkKind::CallArgumentInternalName )
424424 OS << " (" ;
425- else if (I->getKind () == ChunkKind::CallParameterClosureType )
425+ else if (I->getKind () == ChunkKind::CallArgumentClosureType )
426426 OS << " ##" ;
427427 for (char Ch : I->getText ()) {
428428 if (Ch == ' \n ' )
@@ -432,12 +432,12 @@ void CodeCompletionString::print(raw_ostream &OS) const {
432432 }
433433 if (AnnotatedTextChunk)
434434 OS << " ']" ;
435- else if (I->getKind () == ChunkKind::CallParameterInternalName )
435+ else if (I->getKind () == ChunkKind::CallArgumentInternalName )
436436 OS << " )" ;
437437 break ;
438438 case ChunkKind::OptionalBegin:
439- case ChunkKind::CallParameterBegin :
440- case ChunkKind::CallParameterTypeBegin :
439+ case ChunkKind::CallArgumentBegin :
440+ case ChunkKind::CallArgumentTypeBegin :
441441 case ChunkKind::GenericParameterBegin:
442442 OS << " {#" ;
443443 break ;
@@ -461,7 +461,7 @@ void CodeCompletionString::print(raw_ostream &OS) const {
461461 OS << I->getText ();
462462 OS << " #]" ;
463463 break ;
464- case ChunkKind::CallParameterClosureExpr :
464+ case ChunkKind::CallArgumentClosureExpr :
465465 OS << " {" << I->getText () << " |}" ;
466466 break ;
467467 case ChunkKind::BraceStmtWithCursor:
@@ -924,69 +924,63 @@ class AnnotatedTypePrinter : public ASTPrinter {
924924};
925925} // namespcae
926926
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) {
937931 ++CurrentNestingLevel;
938932 using ChunkKind = CodeCompletionString::Chunk::ChunkKind;
939933
940- addSimpleChunk (ChunkKind::CallParameterBegin );
934+ addSimpleChunk (ChunkKind::CallArgumentBegin );
941935
942936 if (shouldAnnotateResults ()) {
943937 if (!Name.empty () || !LocalName.empty ()) {
944938 llvm::SmallString<16 > EscapedKeyword;
945939
946940 if (!Name.empty ()) {
947941 addChunkWithText (
948- CodeCompletionString::Chunk::ChunkKind::CallParameterName ,
942+ CodeCompletionString::Chunk::ChunkKind::CallArgumentName ,
949943 escapeKeyword (Name.str (), false , EscapedKeyword));
950944
951945 if (!LocalName.empty () && Name != LocalName) {
952946 addChunkWithTextNoCopy (ChunkKind::Text, " " );
953947 getLastChunk ().setIsAnnotation ();
954- addChunkWithText (ChunkKind::CallParameterInternalName ,
948+ addChunkWithText (ChunkKind::CallArgumentInternalName ,
955949 escapeKeyword (LocalName.str (), false , EscapedKeyword));
956950 getLastChunk ().setIsAnnotation ();
957951 }
958952 } else {
959953 assert (!LocalName.empty ());
960- addChunkWithTextNoCopy (ChunkKind::CallParameterName , " _" );
954+ addChunkWithTextNoCopy (ChunkKind::CallArgumentName , " _" );
961955 getLastChunk ().setIsAnnotation ();
962956 addChunkWithTextNoCopy (ChunkKind::Text, " " );
963957 getLastChunk ().setIsAnnotation ();
964- addChunkWithText (ChunkKind::CallParameterInternalName ,
958+ addChunkWithText (ChunkKind::CallArgumentInternalName ,
965959 escapeKeyword (LocalName.str (), false , EscapedKeyword));
966960 }
967- addChunkWithTextNoCopy (ChunkKind::CallParameterColon , " : " );
961+ addChunkWithTextNoCopy (ChunkKind::CallArgumentColon , " : " );
968962 }
969963 } else {
970964 if (!Name.empty ()) {
971965 llvm::SmallString<16 > EscapedKeyword;
972966 addChunkWithText (
973- CodeCompletionString::Chunk::ChunkKind::CallParameterName ,
967+ CodeCompletionString::Chunk::ChunkKind::CallArgumentName ,
974968 escapeKeyword (Name.str (), false , EscapedKeyword));
975969 addChunkWithTextNoCopy (
976- CodeCompletionString::Chunk::ChunkKind::CallParameterColon , " : " );
970+ CodeCompletionString::Chunk::ChunkKind::CallArgumentColon , " : " );
977971 } else if (useUnderscoreLabel) {
978972 addChunkWithTextNoCopy (
979- CodeCompletionString::Chunk::ChunkKind::CallParameterName , " _" );
973+ CodeCompletionString::Chunk::ChunkKind::CallArgumentName , " _" );
980974 addChunkWithTextNoCopy (
981- CodeCompletionString::Chunk::ChunkKind::CallParameterColon , " : " );
975+ CodeCompletionString::Chunk::ChunkKind::CallArgumentColon , " : " );
982976 } else if (!LocalName.empty ()) {
983977 // Use local (non-API) parameter name if we have nothing else.
984978 llvm::SmallString<16 > EscapedKeyword;
985979 addChunkWithText (
986- CodeCompletionString::Chunk::ChunkKind::CallParameterInternalName ,
980+ CodeCompletionString::Chunk::ChunkKind::CallArgumentInternalName ,
987981 escapeKeyword (LocalName.str (), false , EscapedKeyword));
988982 addChunkWithTextNoCopy (
989- CodeCompletionString::Chunk::ChunkKind::CallParameterColon , " : " );
983+ CodeCompletionString::Chunk::ChunkKind::CallArgumentColon , " : " );
990984 }
991985 }
992986
@@ -1014,13 +1008,13 @@ void CodeCompletionResultBuilder::addCallParameter(Identifier Name,
10141008 if (ContextTy)
10151009 PO.setBaseType (ContextTy);
10161010 if (shouldAnnotateResults ()) {
1017- withNestedGroup (ChunkKind::CallParameterTypeBegin , [&]() {
1011+ withNestedGroup (ChunkKind::CallArgumentTypeBegin , [&]() {
10181012 AnnotatedTypePrinter printer (*this );
10191013 Ty->print (printer, PO);
10201014 });
10211015 } else {
10221016 std::string TypeName = Ty->getString (PO);
1023- addChunkWithText (ChunkKind::CallParameterType , TypeName);
1017+ addChunkWithText (ChunkKind::CallArgumentType , TypeName);
10241018 }
10251019
10261020 // Look through optional types and type aliases to find out if we have
@@ -1069,12 +1063,12 @@ void CodeCompletionResultBuilder::addCallParameter(Identifier Name,
10691063 OS << " in" ;
10701064
10711065 addChunkWithText (
1072- CodeCompletionString::Chunk::ChunkKind::CallParameterClosureExpr ,
1066+ CodeCompletionString::Chunk::ChunkKind::CallArgumentClosureExpr ,
10731067 OS.str ());
10741068 } else {
10751069 // Add the closure type.
10761070 addChunkWithText (
1077- CodeCompletionString::Chunk::ChunkKind::CallParameterClosureType ,
1071+ CodeCompletionString::Chunk::ChunkKind::CallArgumentClosureType ,
10781072 AFT->getString (PO));
10791073 }
10801074 }
@@ -1381,8 +1375,8 @@ Optional<unsigned> CodeCompletionString::getFirstTextChunkIndex(
13811375 switch (C.getKind ()) {
13821376 using ChunkKind = Chunk::ChunkKind;
13831377 case ChunkKind::Text:
1384- case ChunkKind::CallParameterName :
1385- case ChunkKind::CallParameterInternalName :
1378+ case ChunkKind::CallArgumentName :
1379+ case ChunkKind::CallArgumentInternalName :
13861380 case ChunkKind::GenericParameterName:
13871381 case ChunkKind::LeftParen:
13881382 case ChunkKind::LeftBracket:
@@ -1394,7 +1388,7 @@ Optional<unsigned> CodeCompletionString::getFirstTextChunkIndex(
13941388 case ChunkKind::BaseName:
13951389 case ChunkKind::TypeIdSystem:
13961390 case ChunkKind::TypeIdUser:
1397- case ChunkKind::CallParameterBegin :
1391+ case ChunkKind::CallArgumentBegin :
13981392 return i;
13991393 case ChunkKind::Dot:
14001394 case ChunkKind::ExclamationMark:
@@ -1414,12 +1408,12 @@ Optional<unsigned> CodeCompletionString::getFirstTextChunkIndex(
14141408 case ChunkKind::OverrideKeyword:
14151409 case ChunkKind::EffectsSpecifierKeyword:
14161410 case ChunkKind::DeclIntroducer:
1417- case ChunkKind::CallParameterColon :
1418- case ChunkKind::CallParameterTypeBegin :
1411+ case ChunkKind::CallArgumentColon :
1412+ case ChunkKind::CallArgumentTypeBegin :
14191413 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 :
14231417 case ChunkKind::OptionalBegin:
14241418 case ChunkKind::GenericParameterBegin:
14251419 case ChunkKind::DynamicLookupMethodCallTail:
@@ -2810,11 +2804,11 @@ class CompletionLookup final : public swift::VisibleDeclConsumer {
28102804 if (auto typeContext = CurrDeclContext->getInnermostTypeContext ())
28112805 contextTy = typeContext->getDeclaredTypeInContext ();
28122806
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 );
28182812
28192813 modifiedBuilder = true ;
28202814 NeedComma = true ;
@@ -4192,7 +4186,7 @@ class CompletionLookup final : public swift::VisibleDeclConsumer {
41924186 Type contextTy;
41934187 if (auto typeContext = CurrDeclContext->getInnermostTypeContext ())
41944188 contextTy = typeContext->getDeclaredTypeInContext ();
4195- builder.addCallParameter (Identifier (), RHSType, contextTy);
4189+ builder.addCallArgument (Identifier (), RHSType, contextTy);
41964190 addTypeAnnotation (builder, resultType);
41974191 }
41984192
@@ -4217,7 +4211,7 @@ class CompletionLookup final : public swift::VisibleDeclConsumer {
42174211 Type contextTy;
42184212 if (auto typeContext = CurrDeclContext->getInnermostTypeContext ())
42194213 contextTy = typeContext->getDeclaredTypeInContext ();
4220- builder.addCallParameter (Identifier (), RHSType, contextTy);
4214+ builder.addCallArgument (Identifier (), RHSType, contextTy);
42214215 }
42224216 if (resultType)
42234217 addTypeAnnotation (builder, resultType);
@@ -4476,21 +4470,21 @@ class CompletionLookup final : public swift::VisibleDeclConsumer {
44764470 addFromProto (LK::ColorLiteral, [&](Builder &builder) {
44774471 builder.addBaseName (" #colorLiteral" );
44784472 builder.addLeftParen ();
4479- builder.addCallParameter (context.getIdentifier (" red" ), floatType);
4473+ builder.addCallArgument (context.getIdentifier (" red" ), floatType);
44804474 builder.addComma ();
4481- builder.addCallParameter (context.getIdentifier (" green" ), floatType);
4475+ builder.addCallArgument (context.getIdentifier (" green" ), floatType);
44824476 builder.addComma ();
4483- builder.addCallParameter (context.getIdentifier (" blue" ), floatType);
4477+ builder.addCallArgument (context.getIdentifier (" blue" ), floatType);
44844478 builder.addComma ();
4485- builder.addCallParameter (context.getIdentifier (" alpha" ), floatType);
4479+ builder.addCallArgument (context.getIdentifier (" alpha" ), floatType);
44864480 builder.addRightParen ();
44874481 });
44884482
44894483 auto stringType = context.getStringType ();
44904484 addFromProto (LK::ImageLiteral, [&](Builder &builder) {
44914485 builder.addBaseName (" #imageLiteral" );
44924486 builder.addLeftParen ();
4493- builder.addCallParameter (context.getIdentifier (" resourceName" ),
4487+ builder.addCallArgument (context.getIdentifier (" resourceName" ),
44944488 stringType);
44954489 builder.addRightParen ();
44964490 });
@@ -4690,12 +4684,12 @@ class CompletionLookup final : public swift::VisibleDeclConsumer {
46904684 // FIXME: SemanticContextKind::Local is not correct.
46914685 // Use 'None' (and fix prioritization) or introduce a new context.
46924686 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);
46994693 Builder.addFlair (CodeCompletionFlairBit::ArgumentLabels);
47004694 auto Ty = Arg->getPlainType ();
47014695 if (Arg->isInOut ()) {
0 commit comments