- fun new_nit_generator(classe: nullable ObjcClass, file: FileWriter, init_with_alloc: Bool) do
- if init_with_alloc then
- for method in classe.methods do
- if method.params.first.name.has("init") and not method.is_commented then
- file.write """\n """
- if method.params.first.name == "init" then
- file.write "new"
- else
- nit_method_generator(method, file, init_with_alloc)
- end
- file.write """ in "ObjC" `{\n"""
- new_alloc_init_objc_generator(classe.name, method, file)
- file.write """ `}\n"""
- end
- end
- else
- file.write """\n new in "ObjC"`{\n"""
- new_objc_generator(classe, file)
- file.write """ `}\n"""
+ private fun write_constructors(classe: ObjcClass, file: Writer)
+ do
+ if opt_init_as_methods.value then
+ # A single constructor for `alloc`
+ file.write """
+
+ new in "ObjC" `{
+ return [{{{classe.name}}} alloc];
+ `}
+"""
+ return
+ end
+
+ # A constructor per `init...` method
+ for method in classe.methods do
+ if not method.is_init then continue
+
+ if not model.knows_all_types(method) then method.is_commented = true
+
+ write_method_signature(method, file)
+
+ write_objc_init_call(classe.name, method, file)