+ # Compile CHECKNAME
+ var s = "void CHECKNEW_{name}(val_t self, char *from)"
+ v.add_instr(s + " \{")
+ v.indent
+ var ctx_old = v.ctx
+ v.ctx = new CContext
+ for g in global_properties do
+ var p = self[g]
+ var t = p.signature.return_type
+ if p isa MMAttribute and t != null and not t.is_nullable then
+ v.add_instr("if ({p.global.attr_access}(self) == NIT_NULL) \{ fprintf(stderr, \"Uninitialized attribute %s at %s.\\n\", \"{p.full_name}\", from); nit_exit(1); \}")
+ end
+ end
+ ctx_old.append(v.ctx)
+ v.ctx = ctx_old
+ v.unindent
+ v.add_instr("}")
+