From b2cf2875148794adad48c8b5f2df8ffc4ef376ec Mon Sep 17 00:00:00 2001 From: Jean Privat Date: Tue, 10 Jun 2014 14:53:12 -0400 Subject: [PATCH] model: add `MMethod::is_toplevel` Documentation will like to have such an information easily available. Signed-off-by: Jean Privat --- src/model/model.nit | 4 ++++ src/modelize_property.nit | 1 + 2 files changed, 5 insertions(+) diff --git a/src/model/model.nit b/src/model/model.nit index 629dadb..6732a16 100644 --- a/src/model/model.nit +++ b/src/model/model.nit @@ -1718,6 +1718,10 @@ class MMethod super end + # Is the property defined at the top_level of the module? + # Currently such a property are stored in `Object` + var is_toplevel: Bool writable = false + # Is the property a constructor? # Warning, this property can be inherited by subclasses with or without being a constructor # therefore, you should use `is_init_for` the verify if the property is a legal constructor for a given class diff --git a/src/modelize_property.nit b/src/modelize_property.nit index 5efeb9c..dbdd43a 100644 --- a/src/modelize_property.nit +++ b/src/modelize_property.nit @@ -449,6 +449,7 @@ redef class AMethPropdef mprop = new MMethod(mclassdef, name, mvisibility) mprop.is_init = is_init mprop.is_new = n_kwnew != null + if nclassdef isa ATopClassdef then mprop.is_toplevel = true if not self.check_redef_keyword(modelbuilder, nclassdef, n_kwredef, false, mprop) then return else if not self.check_redef_keyword(modelbuilder, nclassdef, n_kwredef, not self isa AMainMethPropdef, mprop) then return -- 1.7.9.5