From: Jean Privat Date: Mon, 23 Mar 2015 14:16:26 +0000 (+0700) Subject: sepcomp: initialize lazy guards to 'false' if opt_no_union_attribute. X-Git-Tag: v0.7.3~13^2~1 X-Git-Url: http://nitlanguage.org sepcomp: initialize lazy guards to 'false' if opt_no_union_attribute. Otherwise the guard is let at `NULL` (aka uninitialized) and will ironically fail at runtime because the lazy guard is not initialized. Signed-off-by: Jean Privat --- diff --git a/src/compiler/separate_compiler.nit b/src/compiler/separate_compiler.nit index 424b849..00125ea 100644 --- a/src/compiler/separate_compiler.nit +++ b/src/compiler/separate_compiler.nit @@ -2308,3 +2308,14 @@ redef class AMethPropdef return super end end + +redef class AAttrPropdef + redef fun init_expr(v, recv) + do + super + if is_lazy and v.compiler.modelbuilder.toolcontext.opt_no_union_attribute.value then + var guard = self.mlazypropdef.mproperty + v.write_attribute(guard, recv, v.bool_instance(false)) + end + end +end