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

@@ -263,6 +263,7 @@ Job *Swift::constructJob(const JobAction &JA, std::unique_ptr<JobList> Inputs,
Args.AddLastArg(Arguments, options::OPT_import_objc_header);
Args.AddLastArg(Arguments, options::OPT_split_objc_selectors);
Args.AddLastArg(Arguments, options::OPT_implicit_objc_with);
Args.AddLastArg(Arguments, options::OPT_strict_keyword_arguments);
Args.AddLastArg(Arguments, options::OPT_detailed_diagnostics);