X-Git-Url: http://nitlanguage.org diff --git a/src/global_compiler.nit b/src/global_compiler.nit index 44ec3a1..9e79281 100644 --- a/src/global_compiler.nit +++ b/src/global_compiler.nit @@ -124,8 +124,8 @@ class GlobalCompiler # Compile class names (for the class_name and output_class_name methods) protected fun compile_class_names do var v = new_visitor - self.header.add_decl("extern const char const * class_names[];") - v.add("const char const * class_names[] = \{") + self.header.add_decl("extern const char *class_names[];") + v.add("const char *class_names[] = \{") for t in self.runtime_type_analysis.live_types do v.add("\"{t}\", /* {self.classid(t)} */") end @@ -353,6 +353,12 @@ class GlobalCompilerVisitor end end + redef fun native_array_instance(elttype: MType, length: RuntimeVariable): RuntimeVariable + do + var ret_type = self.get_class("NativeArray").get_mtype([elttype]) + return self.new_expr("NEW_{ret_type.c_name}({length})", ret_type) + end + redef fun calloc_array(ret_type, arguments) do self.ret(self.new_expr("NEW_{ret_type.c_name}({arguments[1]})", ret_type))