metamodel: rename 'universal' to 'enum'
[nit.git] / src / metamodel / inheritance.nit
index 196ef85..46e6e88 100644 (file)
@@ -81,7 +81,7 @@ redef class MMLocalClass
                var set = new HashSet[MMLocalClass]
                set.add_all(supers)
                var u = set.to_a
-               module.set_supers_class(self,u)
+               mmmodule.set_supers_class(self,u)
                assert _crhe != null
                assert _cshe != null
                _computing_super = false
@@ -123,12 +123,15 @@ redef class MMLocalClass
                                set.add(glob) # Add the global property
 
                                # Do not inherit constructors trough specialization
-                               #print "{c.module}::{c} -> {module}::{self} for {glob.local_property.local_class.module}::{glob.local_property.local_class}::{glob.local_property} : {glob.is_init}"
+                               #print "{c.mmmodule}::{c} -> {mmmodule}::{self} for {glob.local_property.local_class.mmmodule}::{glob.local_property.local_class}::{glob.local_property} : {glob.is_init}"
                                if glob.is_init and glob.intro.local_class.global != global then
                                        #print "pass"
                                        continue
                                end
 
+                               # Do not inherit new style attributes
+                               if glob.intro.name.to_s[0] == '@' then continue
+
                                make_visible_an_inherited_global_property(glob)
                        end
                end
@@ -184,6 +187,7 @@ redef class MMLocalClass
                                var g = c.get_property_by_name(n)
                                if not set.has(g) then set.add(g)
                                if g.is_init and g.intro.local_class.global != global then continue
+                               if g.intro.name.to_s.first == '@' then continue # inherited new style attibutes are invisible
                                if nset.has(g) then continue
                                nset.add(g)
                        end
@@ -233,7 +237,7 @@ redef class MMLocalClass
                if _ancestors.has_key(c) then
                        return _ancestors[c]
                end
-               var a = c.for_module(module)
+               var a = c.for_module(mmmodule)
                assert cshe <= a
                var ra: MMAncestor
                if _ancestors.has_key(a) then
@@ -262,7 +266,7 @@ redef class MMLocalClass
        private fun add_default_any_class(supers: Array[MMLocalClass])
        do
                if supers.is_empty and name != once ("Object".to_symbol) then
-                       var t_any = module.type_any
+                       var t_any = mmmodule.type_any
                        supers.add(t_any.local_class)
                        var default = new MMDefaultAncestor(self, t_any)
                        add_direct_parent(default)
@@ -275,7 +279,7 @@ redef class MMLocalClass
                assert _crhe != null
                for ref in _crhe.direct_greaters do
                        for sup in ref.cshe.direct_greaters do
-                               var cla = sup.for_module(_module)
+                               var cla = sup.for_module(_mmmodule)
                                supers.add(cla)
                        end
                end
@@ -399,7 +403,7 @@ redef class MMLocalClass
                        # Conflict case (FIXME)
                        if impls2.length != 1 then
                                stderr.write("Fatal error: inherit_local_property error\n")
-                               print("------- {module}::{self} {glob.intro.full_name}")
+                               print("------- {mmmodule}::{self} {glob.intro.full_name}")
                                for i in impls2 do
                                        print("   {i.full_name}")
                                end
@@ -444,8 +448,8 @@ redef class MMAncestor
                tab.add(self)
                stype.local_class.compute_ancestors
                for anc in stype.local_class.ancestors.as(not null) do
-                       var aaa = anc.stype.for_module(stype.module)
-                       var a = aaa.adapt_to(stype).for_module(inheriter.module)
+                       var aaa = anc.stype.for_module(stype.mmmodule)
+                       var a = aaa.adapt_to(stype).for_module(inheriter.mmmodule)
                        if a.local_class != inheriter.local_class then
                                var it = tab.iterator
                                var b = true
@@ -465,7 +469,7 @@ end
 
 # A local class that is a pure importation of an other local class
 class MMImplicitLocalClass
-special MMLocalClass
+       super MMLocalClass
        init(mod: MMModule, g: MMGlobalClass)
        do
                var cla = g.intro
@@ -475,7 +479,7 @@ special MMLocalClass
 end
 
 class MMRefineAncestor
-special MMAncestor
+       super MMAncestor
        redef readable var _local_class: MMLocalClass
 
        init(b: MMLocalClass, a: MMLocalClass)
@@ -488,7 +492,7 @@ end
 
 
 class MMSpecAncestor
-special MMAncestor
+       super MMAncestor
        redef fun local_class do return stype.local_class
 
        init(inheriter: MMType, stype: MMType)
@@ -499,7 +503,7 @@ special MMAncestor
 end
 
 class MMDefaultAncestor
-special MMAncestor
+       super MMAncestor
        redef fun local_class do return stype.local_class
 
        init(b: MMLocalClass, anc: MMType)