src: introduce new constructors
[nit.git] / src / model / model.nit
index cc6ca95..f3c3164 100644 (file)
@@ -1827,6 +1827,9 @@ class MMethod
        # therefore, you should use `is_init_for` the verify if the property is a legal constructor for a given class
        var is_init: Bool writable = false
 
+       # The constructor is a (the) root init with empty signature but a set of initializers
+       var is_root_init: Bool writable = false
+
        # The the property a 'new' contructor?
        var is_new: Bool writable = false
 
@@ -1945,6 +1948,19 @@ class MMethodDef
        # The signature attached to the property definition
        var msignature: nullable MSignature writable = null
 
+       # The signature attached to the `new` call on a root-init
+       # This is a concatenation of the signatures of the initializers
+       #
+       # REQUIRE `mproperty.is_root_init == (new_msignature != null)`
+       var new_msignature: nullable MSignature writable = null
+
+       # List of initialisers to call in root-inits
+       #
+       # They could be setters or attributes
+       #
+       # REQUIRE `mproperty.is_root_init == (new_msignature != null)`
+       var initializers = new Array[MProperty]
+
        # Is the method definition abstract?
        var is_abstract: Bool writable = false