From fcfa2b98f9463e2eb7b501261fcd8b19ad99d375 Mon Sep 17 00:00:00 2001 From: Alexandre Terrasa Date: Tue, 25 Mar 2014 17:25:41 -0400 Subject: [PATCH] model_utils: add MAttribute::is_nullable Signed-off-by: Alexandre Terrasa --- src/model_utils.nit | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/model_utils.nit b/src/model_utils.nit index f893b8d..12b8907 100644 --- a/src/model_utils.nit +++ b/src/model_utils.nit @@ -255,6 +255,15 @@ redef class MClass end end +redef class MAttribute + # Is this attribute nullable for sure? + # + # This mean that its introduction is declarred with a nullable static type + # since attributes are invariant this will work on most cases + # attributes with static type anchored with a virtual type are not "nullable for-sure" + # because this type can be redefined in subclasses + fun is_nullable: Bool do return intro.static_mtype isa MNullableType +end # Sorters -- 1.7.9.5