JoshCheek / seeing_is_believing

Displays the results of every line of code in your file
1.3k stars 54 forks source link

Does not record `else` block if not part of a rescue #73

Closed JoshCheek closed 6 years ago

JoshCheek commented 8 years ago

This works as expected, it records the 2 in the else block.

def a
rescue
else 123  # => 123
end       # => :a
a         # => 123

However, if we remove the rescue, it does not record the else.

def a
else 123
end       # => :a
a         # => 123

Looks like Parser omits it from the AST, I opened an issue here.

My initial diagnosis was this, which may still be relevant at some point in the future: Probably an issue with SeeingIsBelieving::WrapExpressions, the test should go here, or somewhere close by. To fix it, probably follow the recursive invocations through this case statement, and figure out where it abandons the else clause.

If this gets fixed, remove this comment from the Readme.

JoshCheek commented 7 years ago

Fix should have been part of 2.3.1.3 (here).

But it looks like it's still an issue, I opened a second issue here.

whitequark commented 7 years ago

The 2nd issue in Parser is fixed now.