Skip to content

Commit

Permalink
Simplify resetting of current env exception
Browse files Browse the repository at this point in the history
  • Loading branch information
seven1m committed Sep 4, 2023
1 parent 13b4257 commit a9bea86
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions lib/natalie/compiler/instructions/try_instruction.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,7 @@ def generate(transform)
code << t.transform(@discard_catch_result ? nil : "#{result} =")
end

# FIXME: can't we just call set_exception without the clear_exception() call?
code << 'if (exception_was) env->set_exception(exception_was)'
code << 'else env->clear_exception()'

code << 'env->set_exception(exception_was)'
code << 'GlobalEnv::the()->set_rescued(true)'

code << '}'
Expand Down

0 comments on commit a9bea86

Please sign in to comment.