Implement support for making "with" implicit on the first argument of an initializer.

When importing an Objective-C init method or factory method into an
initializer, if the first camelCase word of the first argument name
starts with "with", drop the "with". This means that

  -initWithRed:green:blue:alpha:

will get imported into Swift as

  init(red:green:blue:alpha:)

as will

  +colorWithRed:green:blue:alpha:

This is <rdar://problem/16795899>, hidden behind the
-implicit-objc-with flag.

Swift SVN r17271
This commit is contained in:
Doug Gregor
2014-05-02 21:13:04 +00:00
parent 379bcd327c
commit 4996efbfba
9 changed files with 147 additions and 11 deletions

View File

@@ -550,6 +550,7 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
Opts.EnableAppExtensionRestrictions = Args.hasArg(OPT_enable_app_extension);
Opts.SplitPrepositions = Args.hasArg(OPT_split_objc_selectors);
Opts.ImplicitObjCWith = Args.hasArg(OPT_implicit_objc_with);
Opts.detailedTypeCheckDiagnostics = Args.hasArg(OPT_detailed_diagnostics);
Opts.StrictKeywordArguments = Args.hasArg(OPT_strict_keyword_arguments);