annotation: `as_id` works with operators and setters
authorJean Privat <jean@pryen.org>
Fri, 17 Oct 2014 02:44:18 +0000 (22:44 -0400)
committerJean Privat <jean@pryen.org>
Tue, 21 Oct 2014 23:51:01 +0000 (19:51 -0400)
Signed-off-by: Jean Privat <jean@pryen.org>

src/annotation.nit

index 3223b7c..af63ad3 100644 (file)
@@ -121,6 +121,9 @@ redef class AExpr
        # Return null if not a single identifier.
        fun as_id: nullable String
        do
+               if self isa AMethidExpr then
+                       return self.collect_text
+               end
                if not self isa ACallExpr then return null
                if not self.n_expr isa AImplicitSelfExpr then return null
                if not self.n_args.n_exprs.is_empty then return null