From: Jean Privat Date: Mon, 23 Mar 2015 15:16:18 +0000 (+0700) Subject: Merge: compiler: introduce and use `MType::is_c_primitive` X-Git-Tag: v0.7.3~14 X-Git-Url: http://nitlanguage.org Merge: compiler: introduce and use `MType::is_c_primitive` Thus remove all comparaison to "val*" in the code, this is cleaner. Pull-Request: #1214 Reviewed-by: Alexis Laferrière Reviewed-by: Alexandre Terrasa --- 89cf33299ae2b73b1bbd6088e2a4c156332a09d8 diff --cc src/compiler/abstract_compiler.nit index 5800bad,5d5a4bc..c3952e3 --- a/src/compiler/abstract_compiler.nit +++ b/src/compiler/abstract_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 diff --cc src/compiler/global_compiler.nit index 6b67611,9130588..9a89064 --- a/src/compiler/global_compiler.nit +++ b/src/compiler/global_compiler.nit @@@ -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)