From ae28f4a60f63353e82338ca49bae5e7580f8a372 Mon Sep 17 00:00:00 2001 From: Jean Privat Date: Fri, 20 Apr 2012 10:16:19 -0400 Subject: [PATCH 1/1] model: add MMethod::is_new to distinguish new and init constructors Signed-off-by: Jean Privat --- src/model/model.nit | 3 +++ src/modelbuilder.nit | 1 + 2 files changed, 4 insertions(+) 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 -- 1.7.9.5