From ca865ce247de3c7e8acf89e9617ad331a6e0a65b Mon Sep 17 00:00:00 2001 From: Jean Privat Date: Mon, 23 Mar 2015 21:16:26 +0700 Subject: [PATCH] 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 --- src/compiler/separate_compiler.nit | 11 +++++++++++ 1 file changed, 11 insertions(+) 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 -- 1.7.9.5