Skip to content

Commit

Permalink
Casts can have a side-effect and thus their object can be used
Browse files Browse the repository at this point in the history
  • Loading branch information
nobodywasishere committed Feb 2, 2025
1 parent 59c11ff commit b0e4bf2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/ameba/ast/visitors/implicit_return_visitor.cr
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ module Ameba::AST
if exp.is_a?(Crystal::ControlExpression)
incr_stack { exp.accept(self) }
break
elsif idx == last_idx && old_stack > 0
elsif idx == last_idx && old_stack.positive?
incr_stack { exp.accept(self) }
else
exp.accept(self)
Expand Down Expand Up @@ -162,7 +162,7 @@ module Ameba::AST
def visit(node : Crystal::Cast | Crystal::NilableCast) : Bool
@rule.test(@source, node, @stack.positive?)

node.obj.accept(self)
incr_stack { node.obj.accept(self) }

false
end
Expand Down

0 comments on commit b0e4bf2

Please sign in to comment.