Merge: More keep going
[nit.git] / src / compiler / separate_compiler.nit
index dc24b7c..e07f125 100644 (file)
@@ -252,7 +252,7 @@ class SeparateCompiler
        do
                # Collect all bas box class
                # FIXME: this is not completely fine with a separate compilation scheme
-               for classname in ["Int", "Bool", "Char", "Float", "NativeString", "Pointer"] do
+               for classname in ["Int", "Bool", "Byte", "Char", "Float", "NativeString", "Pointer"] do
                        var classes = self.mainmodule.model.get_mclasses_by_name(classname)
                        if classes == null then continue
                        assert classes.length == 1 else print classes.join(", ")
@@ -769,7 +769,8 @@ class SeparateCompiler
                        end
                        v.add_decl("\},")
                else
-                       v.add_decl("0, \{\}, /*DEAD TYPE*/")
+                       # Use -1 to indicate dead type, the info is used by --hardening
+                       v.add_decl("-1, \{\}, /*DEAD TYPE*/")
                end
                v.add_decl("\};")
        end
@@ -1037,7 +1038,7 @@ class SeparateCompiler
                v.add("if({t} == NULL) \{")
                v.add_abort("type null")
                v.add("\}")
-               v.add("if({t}->table_size == 0) \{")
+               v.add("if({t}->table_size < 0) \{")
                v.add("PRINT_ERROR(\"Insantiation of a dead type: %s\\n\", {t}->name);")
                v.add_abort("type dead")
                v.add("\}")
@@ -1193,7 +1194,7 @@ class SeparateCompilerVisitor
                                if mtype.name == "Int" then
                                        return self.new_expr("(long)({value})>>2", mtype)
                                else if mtype.name == "Char" then
-                                       return self.new_expr("(char)((long)({value})>>2)", mtype)
+                                       return self.new_expr("(uint32_t)((long)({value})>>2)", mtype)
                                else if mtype.name == "Bool" then
                                        return self.new_expr("(short int)((long)({value})>>2)", mtype)
                                else