compiler: create var in `shortcut_equate` only if needed
[nit.git] / src / compiler / global_compiler.nit
index 113b549..94dda37 100644 (file)
@@ -116,7 +116,7 @@ class GlobalCompiler
 
        init
        do
-               var file = new_file("{mainmodule.name}.nitgg")
+               var file = new_file("{mainmodule.c_name}.nitgg")
                self.header = new CodeWriter(file)
                self.live_primitive_types = new Array[MClassType]
                for t in runtime_type_analysis.live_types do
@@ -396,6 +396,7 @@ class GlobalCompilerVisitor
        redef fun native_array_instance(elttype: MType, length: RuntimeVariable): RuntimeVariable
        do
                var ret_type = self.get_class("NativeArray").get_mtype([elttype])
+               ret_type = anchor(ret_type).as(MClassType)
                return self.new_expr("NEW_{ret_type.c_name}({length})", ret_type)
        end