model: add MMethod::is_new to distinguish new and init constructors
authorJean Privat <jean@pryen.org>
Fri, 20 Apr 2012 14:16:19 +0000 (10:16 -0400)
committerJean Privat <jean@pryen.org>
Fri, 20 Apr 2012 20:57:29 +0000 (16:57 -0400)
Signed-off-by: Jean Privat <jean@pryen.org>

src/model/model.nit
src/modelbuilder.nit

index 87b6a15..69ca872 100644 (file)
@@ -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
index f37a940..7d00c2a 100644 (file)
@@ -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