Skip to content

Commit 5d60bfc

Browse files
author
Nathan Hawes
committed
[Migrator] Add doc comments and fix whitespace in TupleSplatMigratorPass.cpp
1 parent 63b40bd commit 5d60bfc

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

lib/Migrator/TupleSplatMigratorPass.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,15 @@ using namespace swift;
2222
using namespace swift::migrator;
2323

2424
namespace {
25-
25+
26+
/// Builds a mapping from each ParamDecl of a ClosureExpr to its references in
27+
/// in the closure body. This is used below to rewrite shorthand param
28+
/// references from $0.1 to $1 and vice versa.
2629
class ShorthandFinder: public ASTWalker {
2730
private:
31+
/// A mapping from each ParamDecl of the supplied ClosureExpr to a list of
32+
/// each referencing DeclRefExpr (e.g. $0) or its immediately containing
33+
/// TupleElementExpr (e.g $0.1) if one exists
2834
llvm::DenseMap<ParamDecl*, std::vector<Expr*>> References;
2935

3036
std::pair<bool, Expr *> walkToExprPre(Expr *E) override {
@@ -117,9 +123,8 @@ struct TupleSplatMigratorPass : public ASTMigratorPass,
117123
std::string TupleText;
118124
{
119125
llvm::raw_string_ostream OS(TupleText);
120-
for (size_t i = 1; i != NativeArity; ++i) {
121-
OS << ", ";
122-
OS << "$" << i;
126+
for (size_t i = 1; i < NativeArity; ++i) {
127+
OS << ", $" << i;
123128
}
124129
OS << ")";
125130
}

0 commit comments

Comments
 (0)