Merge branch 'pu/class_name' into wip
[nit.git] / src / compiling / compiling_global.nit
index 96300b5..1a8a817 100644 (file)
@@ -24,7 +24,7 @@ redef class Program
        # Compile module and class tables
        fun compile_tables_to_c(v: CompilerVisitor)
        do
-               for m in module.mhe.greaters_and_self do
+               for m in main_module.mhe.greaters_and_self do
                        m.compile_local_table_to_c(v)
                end
 
@@ -35,7 +35,7 @@ redef class Program
 
                var s = new Buffer.from("classtable_t TAG2VFT[4] = \{NULL")
                for t in ["Int","Char","Bool"] do
-                       if module.has_global_class_named(t.to_symbol) then
+                       if main_module.has_global_class_named(t.to_symbol) then
                                s.append(", (const classtable_t)VFT_{t}")
                        else
                                s.append(", NULL")
@@ -70,7 +70,7 @@ redef class MMModule
        fun declare_class_tables_to_c(v: CompilerVisitor)
        do
                for c in local_classes do
-                       if c.global.module == self then
+                       if c.global.mmmodule == self then
                                c.declare_tables_to_c(v)
                        end
                end
@@ -116,7 +116,7 @@ redef class MMModule
        # Compile module file for the current module
        fun compile_local_table_to_c(v: CompilerVisitor)
        do
-               v.add_instr("const char *LOCATE_{name} = \"{location.file}\";")
+               v.add_instr("const char *LOCATE_{name} = \"{location.file.filename}\";")
 
                if v.program.tc.use_SFT_optimization or local_table.is_empty then
                        return
@@ -281,6 +281,14 @@ redef class TableEltClassSelfId
        end
 end
 
+redef class TableEltClassSelfName
+       redef fun compile_to_c(v, c)
+       do
+               var prog = v.program
+               return "\"{c.global.name}\" /* {prog.table_information.color(self)}: Class Name */"
+       end
+end
+
 redef class TableEltClassObjectSize
        redef fun compile_to_c(v, c)
        do