model: provide direct methods to access primitive types
[nit.git] / src / compiler / separate_erasure_compiler.nit
index 8a33265..ada0bbf 100644 (file)
@@ -39,6 +39,11 @@ redef class ToolContext
                if opt_no_check_all.value then
                        opt_no_check_erasure_cast.value = true
                end
+
+               # Temporary disabled. TODO: implement tagging in the erasure compiler.
+               if opt_erasure.value then
+                       opt_no_tag_primitives.value = true
+               end
        end
 
        var erasure_compiler_phase = new ErasureCompilerPhase(self, null)
@@ -235,13 +240,9 @@ class SeparateErasureCompiler
                                                v.add_decl("NULL, /* DEAD {mclass.intro_mmodule}:{mclass}:{mpropdef} */")
                                                continue
                                        end
-                                       if true or mpropdef.mclassdef.bound_mtype.ctype != "val*" then
-                                               v.require_declaration("VIRTUAL_{mpropdef.c_name}")
-                                               v.add_decl("(nitmethod_t)VIRTUAL_{mpropdef.c_name}, /* pointer to {mclass.intro_mmodule}:{mclass}:{mpropdef} */")
-                                       else
-                                               v.require_declaration("{mpropdef.c_name}")
-                                               v.add_decl("(nitmethod_t){mpropdef.c_name}, /* pointer to {mclass.intro_mmodule}:{mclass}:{mpropdef} */")
-                                       end
+                                       var rf = mpropdef.virtual_runtime_function
+                                       v.require_declaration(rf.c_name)
+                                       v.add_decl("(nitmethod_t){rf.c_name}, /* pointer to {mpropdef.full_name} */")
                                end
                        end
                        v.add_decl("\}")
@@ -642,7 +643,7 @@ class SeparateErasureCompilerVisitor
 
        redef fun native_array_instance(elttype, length)
        do
-               var nclass = self.get_class("NativeArray")
+               var nclass = mmodule.native_array_class
                var mtype = nclass.get_mtype([elttype])
                var res = self.new_var(mtype)
                res.is_exact = true