Skip to content

Commit

Permalink
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions src/compiler/crystal/tools/formatter.cr
Original file line number Diff line number Diff line change
@@ -2776,20 +2776,23 @@ module Crystal
if body.is_a?(Expressions)
body.expressions = body.expressions[to_skip..-1]
if body.expressions.empty?
case node
when Def, ExceptionHandler
node.body = Nop.new
end
set_body(node, Nop.new)
end
else
case node
when Def, ExceptionHandler
node.body = Nop.new
end
set_body(node, Nop.new)
end
end
end

def set_body(node, body)
case node
when Def
node.body = body
when ExceptionHandler
node.body = body
end
end

def visit(node : IsA)
if node.nil_check?
accept node.obj

0 comments on commit 25a52af

Please sign in to comment.