metamodel: rename 'universal' to 'enum'
authorJean Privat <jean@pryen.org>
Wed, 9 Feb 2011 16:34:23 +0000 (11:34 -0500)
committerJean Privat <jean@pryen.org>
Mon, 14 Feb 2011 20:15:47 +0000 (15:15 -0500)
In the identifiers used in the metamodel and in the error messages.

Signed-off-by: Jean Privat <jean@pryen.org>

src/analysis/rta_analysis.nit
src/metamodel/abstractmetamodel.nit
src/primitive_info.nit
src/syntax/mmbuilder.nit
src/syntax/typing.nit
tests/sav/error_kern_attr_int.sav

index a10dcac..aef8da8 100644 (file)
@@ -165,7 +165,7 @@ class RtaBuilder
                end
 
                for cls in program.main_module.global_classes do
-                       if not cls.is_universal then continue
+                       if not cls.is_enum then continue
                        add_instantiated_class(program.main_module[cls])
                end
        end
index 8a26854..68c30dd 100644 (file)
@@ -299,8 +299,8 @@ class MMGlobalClass
        # Is the global class an abstract class?
        readable writable var _is_abstract: Bool = false
 
-       # Is the global class a universal class?
-       readable writable var _is_universal: Bool = false
+       # Is the global class a enum class?
+       readable writable var _is_enum: Bool = false
 
        # Visibility of the global class
        # 1 -> public
index e926e48..60da40d 100644 (file)
@@ -30,7 +30,6 @@ redef class MMLocalClass
 
        # Return the primitive information of the class.
        # Return null if the class is not primitive
-       # FIXME: Only here since there is no universal type yet
        fun primitive_info: nullable PrimitiveInfo
        do
                if _primitive_info_b == true then return _primitive_info_cache
index 720d49e..35c474b 100644 (file)
@@ -97,7 +97,7 @@ redef class MMSrcModule
                        c.accept_class_visitor(mmbv2)
 
                        # Default and inherited constructor if needed
-                       if c isa MMSrcLocalClass and c.global.intro == c and not c.global.is_universal and not c.global.is_interface then
+                       if c isa MMSrcLocalClass and c.global.intro == c and not c.global.is_enum and not c.global.is_interface then
                                c.process_default_constructors(mmbv2)
                        end
 
@@ -183,7 +183,7 @@ redef class MMSrcLocalClass
                var super_inits = new ArraySet[MMLocalProperty]
                var super_constructors = new ArraySet[MMGlobalProperty]
                for sc in che.direct_greaters do
-                       if sc.global.is_universal or sc.global.is_interface then continue
+                       if sc.global.is_enum or sc.global.is_interface then continue
                        for gp in sc.global_properties do
                                if not gp.is_init then continue
                                super_constructors.add(gp)
@@ -569,7 +569,7 @@ end
 
 redef class AClasskind
        fun is_interface: Bool do return false
-       fun is_universal: Bool do return false
+       fun is_enum: Bool do return false
        fun is_abstract: Bool do return false
 end
 
@@ -577,7 +577,7 @@ redef class AInterfaceClasskind
        redef fun is_interface do return true
 end
 redef class AEnumClasskind
-       redef fun is_universal do return true
+       redef fun is_enum do return true
 end
 redef class AAbstractClasskind
        redef fun is_abstract do return true
@@ -601,7 +601,7 @@ redef class AStdClassdef
                        glob.visibility_level = visibility_level
                        glob.is_interface = n_classkind.is_interface
                        glob.is_abstract = n_classkind.is_abstract
-                       glob.is_universal = n_classkind.is_universal
+                       glob.is_enum = n_classkind.is_enum
                        if n_kwredef != null then
                                v.error(self, "Redef error: No class {name} is imported. Remove the redef keyword to define a new class.")
                        end
@@ -609,18 +609,18 @@ redef class AStdClassdef
                        for c in _local_class.cshe.direct_greaters do
                                var cg = c.global
                                if glob.is_interface then
-                                       if cg.is_universal then
-                                               v.error(self, "Special error: Interface {name} try to specialise universal class {c.name}.")
+                                       if cg.is_enum then
+                                               v.error(self, "Special error: Interface {name} try to specialise enum class {c.name}.")
                                        else if not cg.is_interface then
                                                v.error(self, "Special error: Interface {name} try to specialise class {c.name}.")
                                        end
-                               else if glob.is_universal then
-                                       if not cg.is_interface and not cg.is_universal then
-                                               v.error(self, "Special error: Universal class {name} try to specialise class {c.name}.")
+                               else if glob.is_enum then
+                                       if not cg.is_interface and not cg.is_enum then
+                                               v.error(self, "Special error: Enum class {name} try to specialise class {c.name}.")
                                        end
                                else
-                                       if cg.is_universal then
-                                               v.error(self, "Special error: Class {name} try to specialise universal class {c.name}.")
+                                       if cg.is_enum then
+                                               v.error(self, "Special error: Class {name} try to specialise enum class {c.name}.")
                                        end
                                end
 
@@ -643,7 +643,7 @@ redef class AStdClassdef
                if 
                        not glob.is_interface and n_classkind.is_interface or
                        not glob.is_abstract and n_classkind.is_abstract or
-                       not glob.is_universal and n_classkind.is_universal
+                       not glob.is_enum and n_classkind.is_enum
                then
                        v.error(self, "Redef error: cannot change kind of class {name}.")
                end
@@ -772,14 +772,14 @@ redef class APropdef
                if glob.is_attribute then
                        if gbc.is_interface then
                                v.error(self, "Error: Attempt to define attribute {prop} in the interface {prop.local_class}.")
-                       else if gbc.is_universal then
-                               v.error(self, "Error: Attempt to define attribute {prop} in the universal class {prop.local_class}.")
+                       else if gbc.is_enum then
+                               v.error(self, "Error: Attempt to define attribute {prop} in the enum class {prop.local_class}.")
                        end
                else if glob.is_init then
                        if gbc.is_interface then
                                v.error(self, "Error: Attempt to define a constructor {prop} in the class {prop.local_class}.")
-                       else if gbc.is_universal then
-                               v.error(self, "Error: Attempt to define a constructor {prop} in the universal {prop.local_class}.")
+                       else if gbc.is_enum then
+                               v.error(self, "Error: Attempt to define a constructor {prop} in the enum {prop.local_class}.")
                        end
                end
                if prop.signature == null then
index 34dc5f1..2382bde 100644 (file)
@@ -252,7 +252,7 @@ redef class AConcreteInitPropdef
                        var j = 0
                        while j < v.local_class.cshe.direct_greaters.length do
                                var c = v.local_class.cshe.direct_greaters[j]
-                               if c.global.is_interface or c.global.is_universal or c.global.is_mixin then
+                               if c.global.is_interface or c.global.is_enum or c.global.is_mixin then
                                        j += 1
                                else if cur_c != null and (c.cshe <= cur_c or cur_c.global.is_mixin) then
                                        if c == cur_c then j += 1
index 3c595a3..f5e7a14 100644 (file)
@@ -1 +1 @@
-./error_kern_attr_int.nit:18,2--18: Error: Attempt to define attribute _toto in the universal class Int.
+./error_kern_attr_int.nit:18,2--18: Error: Attempt to define attribute _toto in the enum class Int.