Merge: compiler: introduce and use `MType::is_c_primitive`
authorJean Privat <jean@pryen.org>
Mon, 23 Mar 2015 15:16:18 +0000 (22:16 +0700)
committerJean Privat <jean@pryen.org>
Mon, 23 Mar 2015 15:16:18 +0000 (22:16 +0700)
Thus remove all comparaison to "val*" in the code, this is cleaner.

Pull-Request: #1214
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>

1  2 
src/compiler/abstract_compiler.nit
src/compiler/global_compiler.nit
src/compiler/separate_compiler.nit
src/compiler/separate_erasure_compiler.nit

@@@ -2325,9 -2300,9 +2331,9 @@@ redef class AAttrPropde
                        v.write_attribute(self.mpropdef.mproperty, arguments.first, arguments[1])
                        if is_lazy then
                                var ret = self.mpropdef.static_mtype
-                               var useiset = ret.ctype == "val*" and not ret isa MNullableType
+                               var useiset = not ret.is_c_primitive and not ret isa MNullableType
                                if not useiset then
 -                                      v.write_attribute(self.mlazypropdef.mproperty, arguments.first, v.new_expr("1", v.bool_type))
 +                                      v.write_attribute(self.mlazypropdef.mproperty, arguments.first, v.bool_instance(true))
                                end
                        end
                else
@@@ -628,9 -628,9 +628,9 @@@ class GlobalCompilerVisito
  
        fun bugtype(recv: RuntimeVariable)
        do
-               if recv.mtype.ctype != "val*" then return
+               if recv.mtype.is_c_primitive then return
                self.add("PRINT_ERROR(\"BTD BUG: Dynamic type is %s, static type is %s\\n\", class_names[{recv}->classid], \"{recv.mcasttype}\");")
 -              self.add("show_backtrace(1);")
 +              self.add("fatal_exit(1);")
        end
  
        redef fun isset_attribute(a, recv)
Simple merge