[Migrator] Remove closure shorthand prefixing.

In https://github.com/apple/swift/pull/10414, some SE-0110 features
were backed out, so the Migrator no longer needs to add `$0` shorthand
prefixing.

rdar://problem/32907276
This commit is contained in:
David Farler
2017-06-21 14:25:53 -07:00
parent c7e01f2152
commit 9c1fa89d41
2 changed files with 4 additions and 14 deletions

View File

@@ -96,20 +96,10 @@ struct TupleSplatMigratorPass : public ASTMigratorPass,
}
unsigned ClosureArity = Closure->getParameters()->size();
if (NativeArity == ClosureArity)
if (NativeArity <= ClosureArity)
return false;
ShorthandFinder Finder(Closure);
if (NativeArity == 1 && ClosureArity > 1) {
// Prepend $0. to existing references
Finder.forEachReference([this](Expr *Ref, ParamDecl* Def) {
if (auto *TE = dyn_cast<TupleElementExpr>(Ref))
Ref = TE->getBase();
SourceLoc AfterDollar = Ref->getStartLoc().getAdvancedLoc(1);
Editor.insert(AfterDollar, "0.");
});
return true;
}
if (ClosureArity == 1 && NativeArity > 1) {
// Remove $0. from existing references or if it's only $0, replace it