|
|
| Previous ID |
SR-7292 |
| Radar |
None |
| Original Reporter |
@nkcsgexi |
| Type |
New Feature |
| Status |
Resolved |
| Resolution |
Done |
Additional Detail from JIRA
|
|
| Votes |
0 |
| Component/s |
Source Tooling |
| Labels |
New Feature, Refactoring, StarterBug |
| Assignee |
mohit.athwani (JIRA) |
| Priority |
Medium |
md5: 717c1a5493eaa3054e6b1fecb975394a
Issue Description:
Some initializers' implementation is quite expectable, e.g. a field-wise naive initializer. Thus, we can implement an automated refactoring to help developers adding such initializer, e.g.
// Right click on Animal and apply "add field-wise init" refactoring
class Animal {
var age: Int
var kind: AnimalKind
var gender: Gender
}
An available refactoring "add field-wise init" shows up when the user right clicks the declared name Animal. After applying the local refactoring, the code snippet transforms to:
// code placeholder
class Animal {
var age: Int
var kind: AnimalKind
var gender: Gender
// Auto-generated initializer
init(age: Int, kind: AnimalKind, gender: Gender) {
self.age = age
self.kind = kind
self.gender = gender
}
}
Additional Detail from JIRA
md5: 717c1a5493eaa3054e6b1fecb975394a
Issue Description:
Some initializers' implementation is quite expectable, e.g. a field-wise naive initializer. Thus, we can implement an automated refactoring to help developers adding such initializer, e.g.
An available refactoring "add field-wise init" shows up when the user right clicks the declared name
Animal. After applying the local refactoring, the code snippet transforms to: