mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Merge pull request #36551 from ahoppen/pr/internal-labels-in-closures
[CodeComplete] Default parameter names of completed closure to internal names
This commit is contained in:
@@ -4801,10 +4801,23 @@ public:
|
||||
Printer.printStructurePost(PrintStructureKind::FunctionParameter);
|
||||
};
|
||||
|
||||
if (printLabels && Param.hasLabel()) {
|
||||
if ((Options.AlwaysTryPrintParameterLabels || printLabels) &&
|
||||
Param.hasLabel()) {
|
||||
// Label printing was requested and we have an external label. Print it
|
||||
// and omit the internal label.
|
||||
Printer.printName(Param.getLabel(),
|
||||
PrintNameContext::FunctionParameterExternal);
|
||||
Printer << ": ";
|
||||
} else if (Options.AlwaysTryPrintParameterLabels &&
|
||||
Param.hasInternalLabel()) {
|
||||
// We didn't have an external parameter label but were requested to
|
||||
// always try and print parameter labels. Print The internal label.
|
||||
// If we have neither an external nor an internal label, only print the
|
||||
// type.
|
||||
Printer << "_ ";
|
||||
Printer.printName(Param.getInternalLabel(),
|
||||
PrintNameContext::FunctionParameterLocal);
|
||||
Printer << ": ";
|
||||
}
|
||||
|
||||
auto type = Param.getPlainType();
|
||||
|
||||
Reference in New Issue
Block a user