From: Jean Privat Date: Fri, 20 Apr 2012 14:16:19 +0000 (-0400) Subject: model: add MMethod::is_new to distinguish new and init constructors X-Git-Tag: v0.6~362^2~3 X-Git-Url: http://nitlanguage.org model: add MMethod::is_new to distinguish new and init constructors Signed-off-by: Jean Privat --- diff --git a/src/model/model.nit b/src/model/model.nit index 87b6a15..69ca872 100644 --- a/src/model/model.nit +++ b/src/model/model.nit @@ -1285,6 +1285,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 the property a 'new' contructor? + var is_new: Bool writable = false + # Is the property a legal constructor for a given class? # As usual, visibility is not considered. # FIXME not implemented diff --git a/src/modelbuilder.nit b/src/modelbuilder.nit index f37a940..7d00c2a 100644 --- a/src/modelbuilder.nit +++ b/src/modelbuilder.nit @@ -1000,6 +1000,7 @@ redef class AMethPropdef var mvisibility = new_property_visibility(modelbuilder, nclassdef, self.n_visibility) mprop = new MMethod(mclassdef, name, mvisibility) mprop.is_init = is_init + mprop.is_new = self isa AExternInitPropdef self.check_redef_keyword(modelbuilder, nclassdef, n_kwredef, false, mprop) else if n_kwredef == null then