Merge: Prepare for new constructors
authorJean Privat <jean@pryen.org>
Fri, 15 Aug 2014 21:21:39 +0000 (17:21 -0400)
committerJean Privat <jean@pryen.org>
Fri, 15 Aug 2014 21:21:39 +0000 (17:21 -0400)
commitbbfd04728005f6baa3cba64c4e1e83a229a3a9cb
treebc02b9bd96d25b3e5ccc131fe1115f651b58ddf1
parenta6bb00d9455b7ff73ab282f28d77bca607bf0c98
parent2f547508089b03d75b52c028bcf6d237fa1f18c0
Merge: Prepare for new constructors

With new constructors, attributes without default value are considered even if a constructor is present.

So, while ugly, the following code is currently working.
~~~
class A
   var attr: Attr
   init do attr = new Attr(foo)
end
var a = new A
~~~

With the new constructors, the attribute `attr` will be part of the signature of the new,

~~~
var a = new A # Error, expected one argument `attr: Attr`
~~~

So this series do some cosmetic changes to accommodate the future new constructors.
Most of these change make senes own their own since they:

* reduce the number of lines by removing useless init
* clarify the behavior of some attributes by adding a default value or a `noinit` annotation

More precisely, easy cases of the previous code is usually migrated into

~~~
class A
   var attr = new Attr(foo)
end
var a = new A
~~~

And complex cases into

~~~
class A
   var attr: Attr is noinit
   init do attr = new Attr(foo)
end
var a = new A
~~~

The few remaining very complex cases (ex parser) will be migrated latter, and a temporally new annotation `old_style_init` may be created for them.

Pull-Request: #674
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>