syntax: warn on superfluous empty parentheses on calls
authorJean Privat <jean@pryen.org>
Fri, 24 Feb 2012 16:55:45 +0000 (11:55 -0500)
committerJean Privat <jean@pryen.org>
Fri, 24 Feb 2012 16:55:45 +0000 (11:55 -0500)
Signed-off-by: Jean Privat <jean@pryen.org>

src/syntax/typing.nit

index 77f9779..4155ecc 100644 (file)
@@ -403,6 +403,15 @@ redef class AParExpr
        end
 end
 
+redef class AParExprs
+       redef fun after_typing(v)
+       do
+               if n_exprs.is_empty then
+                       v.warning(self, "Warning: superfluous parentheses.")
+               end
+       end
+end
+
 redef class AVardeclExpr
        var _variable: nullable VarVariable
        redef fun variable do return _variable.as(not null)