mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Start importing factory methods as initializers.
When an Objective-C class method follows the naming convention of a factory method, i.e., its starting words match the ending words of the class name, import it as a convenience initializer when it also: - Returns instancetype (i.e., dynamic Self in Swift parlance) - Has no NSError** parameters, which indicate the potential for failures This is under a new flag (-enable-objc-factory-method-constructors) because it is not generally functional. However, this is a step toward <rdar://problem/16509024>. Swift SVN r16479
This commit is contained in:
@@ -566,6 +566,8 @@ static bool ParseClangImporterArgs(ClangImporterOptions &Opts, ArgList &Args,
|
||||
|
||||
Opts.InferImplicitProperties =
|
||||
Args.hasArg(OPT_enable_objc_implicit_properties);
|
||||
Opts.ImportFactoryMethodsAsConstructors =
|
||||
Args.hasArg(OPT_enable_objc_factory_method_constructors);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user