From 2b60f59eb3d188d23a998bc391b40dcb448ab315 Mon Sep 17 00:00:00 2001 From: Jean Privat Date: Wed, 29 Oct 2014 12:58:26 -0400 Subject: [PATCH] semantize: move noinit attribute to `AAttrPropdef::build_property` Signed-off-by: Jean Privat --- src/modelize/modelize_property.nit | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/modelize/modelize_property.nit b/src/modelize/modelize_property.nit index 69e1633..10b6ad4 100644 --- a/src/modelize/modelize_property.nit +++ b/src/modelize/modelize_property.nit @@ -144,14 +144,7 @@ redef class ModelBuilder end if npropdef isa AAttrPropdef then if npropdef.mpropdef == null then return # Skip broken attribute - var at = npropdef.get_single_annotation("noinit", self) - if at != null then - npropdef.noinit = true - if npropdef.has_value then - self.error(at, "Error: `noinit` attributes cannot have an initial value") - end - continue # Skip noinit attributes - end + if npropdef.noinit then continue # Skip noinit attribute if npropdef.has_value then continue var paramname = npropdef.mpropdef.mproperty.name.substring_from(1) var ret_type = npropdef.mpropdef.static_mtype @@ -804,6 +797,15 @@ redef class AAttrPropdef has_value = n_expr != null or n_block != null + var atnoinit = self.get_single_annotation("noinit", modelbuilder) + if atnoinit != null then + noinit = true + if has_value then + modelbuilder.error(atnoinit, "Error: `noinit` attributes cannot have an initial value") + return + end + end + var atlazy = self.get_single_annotation("lazy", modelbuilder) if atlazy != null then if not has_value then -- 1.7.9.5