Merge: Simplify constructors: next episode
authorJean Privat <jean@pryen.org>
Tue, 28 Jan 2020 20:03:47 +0000 (15:03 -0500)
committerJean Privat <jean@pryen.org>
Tue, 28 Jan 2020 20:03:47 +0000 (15:03 -0500)
commit9c25a1a467a92762e7ab7197a6702b1b73aa2ec3
tree1d747899f328a0d9e2a6b3c25c5a0bae12f5fe91
parentca8f5eca8a69bd85077ad626293bcf01e9a11295
parente23dab6c302d45ec7b10f99d79dcc4d5cf43b6a4
Merge: Simplify constructors: next episode

The current constructors are quite complex, that is why Jean Privat had proposed to simplify them with the pr #1966.

The current init has a double facet, internal with a signature and an empty body and an external one with a signature and initializer represent the attributes to initialize.

This pr replace the external facet by introducing a new constructor defaultinit specific to each class. This default property includes the orchestration of initializers (non-default attributes, autoinit methods, and autoinit annotation in the class). In addition, this property is now the one exposed when a new A is executed.

The current init used to manually set the default constructor it's used to perform a processing after initialization. Note this one must have an empty signature. If this is not the case, an error will be generated.

To use the init in a similar way, we now have to use the old_style_init annotation.

This pr resolve minor bugs and test issues of the Jean's pr .

Pull-Request: #2803
Reviewed-by: Jean Privat <jean@pryen.org>
src/compiler/abstract_compiler.nit
src/rapid_type_analysis.nit