Merge: Improve free init to prepare new constructors
authorJean Privat <jean@pryen.org>
Tue, 13 May 2014 15:46:30 +0000 (11:46 -0400)
committerJean Privat <jean@pryen.org>
Tue, 13 May 2014 15:46:30 +0000 (11:46 -0400)
Yet another series toward the new constructors.

Some cleanup but also some changes in the current specification to be more compatible with the next one.

In the previous code, there was 3 distinct ways to have free constructors:

1. there is some complex constructors in ONE superclass ; then they are inherited and usable as it ; error if more than one superclass with complex constructors
2. in super-classes there is only constructor named init and without parameters ; then a new free constructor is generated that just invoke the inherited init.
3. there is no inherited consructors ; then all uninitialized attributes are collected to produce a new constructor with parameters

The series generalize the point about uninitialized attributes, so make the 3 ways less distinct:

* in 1, if there is uninitialized attributes a error is generated
* in 2, if there is uninitialized attributes, they are given as parameter do the generated free constructor
* 3 does not change, but just become a special case of 2.

To enable the new behavior, an update was needed on some piece of code. mainly:

1. give a default value to some attributes to avoid their collect in the free constructor
2. give an explicit empty init when some attributes cannot have a default value

Achievement Unlocked: Edit 200 constructors in one PR +50 nitCoins

Pull-Request: #459
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>


Trivial merge