model: introduce `MMethod::is_null_safe`
authorJean Privat <jean@pryen.org>
Wed, 27 May 2015 23:22:17 +0000 (19:22 -0400)
committerJean Privat <jean@pryen.org>
Wed, 27 May 2015 23:22:17 +0000 (19:22 -0400)
Signed-off-by: Jean Privat <jean@pryen.org>

src/model/model.nit

index 94f11f2..e4b881f 100644 (file)
@@ -2153,6 +2153,10 @@ class MMethod
        do
                return self.is_init
        end
+
+       # A specific method that is safe to call on null.
+       # Currently, only `==`, `!=` and `is_same_instance` are safe
+       fun is_null_safe: Bool do return name == "==" or name == "!=" or name == "is_same_instance"
 end
 
 # A global attribute