X-Git-Url: http://nitlanguage.org diff --git a/src/compiler/separate_compiler.nit b/src/compiler/separate_compiler.nit index 63f5517..c4defe0 100644 --- a/src/compiler/separate_compiler.nit +++ b/src/compiler/separate_compiler.nit @@ -252,11 +252,11 @@ class SeparateCompiler do # Collect all bas box class # FIXME: this is not completely fine with a separate compilation scheme - for classname in ["Int", "Bool", "Byte", "Char", "Float", "NativeString", + for classname in ["Int", "Bool", "Byte", "Char", "Float", "CString", "Pointer", "Int8", "Int16", "UInt16", "Int32", "UInt32"] do var classes = self.mainmodule.model.get_mclasses_by_name(classname) if classes == null then continue - assert classes.length == 1 else print classes.join(", ") + assert classes.length == 1 else print_error classes.join(", ") self.box_kinds[classes.first] = self.box_kinds.length + 1 end end @@ -269,7 +269,7 @@ class SeparateCompiler #if mclass.mclass_type.ctype == "val*" or mclass.mclass_type.is_subtype(self.mainmodule, mclass.mclass_type pointer_type) then if mclass.mclass_type.ctype_extern == "val*" then return 0 - else if mclass.kind == extern_kind and mclass.name != "NativeString" then + else if mclass.kind == extern_kind and mclass.name != "CString" then return self.box_kinds[self.mainmodule.pointer_type.mclass] else return self.box_kinds[mclass] @@ -938,9 +938,9 @@ class SeparateCompiler v.add("return (val*){res};") v.add("\}") return - else if mtype.mclass.kind == extern_kind and mtype.mclass.name != "NativeString" then - # Is an extern class (other than Pointer and NativeString) - # Pointer is caught in a previous `if`, and NativeString is internal + else if mtype.mclass.kind == extern_kind and mtype.mclass.name != "CString" then + # Is an extern class (other than Pointer and CString) + # Pointer is caught in a previous `if`, and CString is internal var pointer_type = mainmodule.pointer_type @@ -1242,7 +1242,7 @@ class SeparateCompilerVisitor return res end var valtype = value.mtype.as(MClassType) - if mtype isa MClassType and mtype.mclass.kind == extern_kind and mtype.mclass.name != "NativeString" then + if mtype isa MClassType and mtype.mclass.kind == extern_kind and mtype.mclass.name != "CString" then valtype = compiler.mainmodule.pointer_type end var res = self.new_var(mtype) @@ -1267,7 +1267,7 @@ class SeparateCompilerVisitor redef fun unbox_extern(value, mtype) do if mtype isa MClassType and mtype.mclass.kind == extern_kind and - mtype.mclass.name != "NativeString" then + mtype.mclass.name != "CString" then var pointer_type = compiler.mainmodule.pointer_type var res = self.new_var_extern(mtype) self.add "{res} = ((struct instance_{pointer_type.c_name}*){value})->value; /* unboxing {value.mtype} */" @@ -1280,7 +1280,7 @@ class SeparateCompilerVisitor redef fun box_extern(value, mtype) do if mtype isa MClassType and mtype.mclass.kind == extern_kind and - mtype.mclass.name != "NativeString" then + mtype.mclass.name != "CString" then var valtype = compiler.mainmodule.pointer_type var res = self.new_var(mtype) compiler.undead_types.add(mtype) @@ -1888,7 +1888,7 @@ class SeparateCompilerVisitor if not value.mtype.is_c_primitive then self.add "{res} = {value} == NULL ? \"null\" : {type_info(value)}->name;" else if value.mtype isa MClassType and value.mtype.as(MClassType).mclass.kind == extern_kind and - value.mtype.as(MClassType).name != "NativeString" then + value.mtype.as(MClassType).name != "CString" then self.add "{res} = \"{value.mtype.as(MClassType).mclass}\";" else self.require_declaration("type_{value.mtype.c_name}")