pretty: workaround a bug with a missing `else`
authorJean Privat <jean@pryen.org>
Fri, 24 Apr 2015 11:19:21 +0000 (18:19 +0700)
committerJean Privat <jean@pryen.org>
Mon, 4 May 2015 20:08:12 +0000 (16:08 -0400)
Signed-off-by: Jean Privat <jean@pryen.org>

src/pretty.nit

index b4a14b3..20c3550 100644 (file)
@@ -1287,7 +1287,10 @@ redef class AIfExpr
                        end
 
                        v.consume_comments
-                       if has_else(v) then
+
+                       # FIXME: for some unknown reasons, has_else can be true even if
+                       # there is no `else` keyword but a `end` instead.
+                       if has_else(v) and v.current_token isa TKwelse then
 
                                v.indent -= 1
                                v.addt