Prepare Nit code for inherited and automatic constructors.
[nit.git] / src / compiling / compiling_global.nit
index b3fd43f..b2c6931 100644 (file)
@@ -23,7 +23,7 @@ private import syntax
 
 # Something that store color of table elements
 class ColorContext
-       attr _colors: HashMap[TableElt, Int]
+       attr _colors: HashMap[TableElt, Int] = null
 
        # The color of a table element.
        meth color(e: TableElt): Int
@@ -492,7 +492,7 @@ redef class MMSrcModule
        # Compile sep files 
        meth compile_mod_to_c(v: CompilerVisitor)
        do
-               v.add_decl("#define LOCATE_{name} \"{filename}\"")
+               v.add_decl("extern const char *LOCATE_{name};")
                if not v.tc.global then
                        v.add_decl("extern const int SFT_{name}[];")
                end
@@ -526,6 +526,8 @@ redef class MMSrcModule
        # Compile module file for the current module
        meth compile_local_table_to_c(v: CompilerVisitor)
        do
+               v.add_instr("const char *LOCATE_{name} = \"{filename}\";")
+
                if v.tc.global or _local_table.is_empty then
                        return
                end