X-Git-Url: http://nitlanguage.org diff --git a/src/modelize/modelize_property.nit b/src/modelize/modelize_property.nit index 487110f..28e6a03 100644 --- a/src/modelize/modelize_property.nit +++ b/src/modelize/modelize_property.nit @@ -122,6 +122,26 @@ redef class ModelBuilder var mparameters = new Array[MParameter] var initializers = new Array[MProperty] for npropdef in nclassdef.n_propdefs do + if npropdef isa AMethPropdef then + if npropdef.mpropdef == null then return # Skip broken attribute + var at = npropdef.get_single_annotation("autoinit", self) + if at == null then continue # Skip non tagged init + + var sig = npropdef.mpropdef.msignature + if sig == null then continue # Skip broken method + + if not npropdef.mpropdef.is_intro then + self.error(at, "Error: `autoinit` cannot be set on redefinitions") + continue + end + + for param in sig.mparameters do + var ret_type = param.mtype + var mparameter = new MParameter(param.name, ret_type, false) + mparameters.add(mparameter) + end + initializers.add(npropdef.mpropdef.mproperty) + end if npropdef isa AAttrPropdef then if npropdef.mpropdef == null then return # Skip broken attribute var at = npropdef.get_single_annotation("noinit", self) @@ -269,9 +289,6 @@ end redef class AClassdef var build_properties_is_done: Bool = false - # The list of super-constructor to call at the start of the free constructor - # FIXME: this is needed to implement the crazy constructor thing of the of old compiler. We need to think what to do with since this cannot stay in the modelbuilder - var super_inits: nullable Collection[MMethod] = null # The free init (implicitely constructed by the class if required) var mfree_init: nullable MMethodDef = null