Skip to content

Commit

Permalink
Fix: sucessfull (zero) catchs don't unwind the stack
Browse files Browse the repository at this point in the history
  • Loading branch information
davazp committed Apr 12, 2012
1 parent 45fbc68 commit 511a7a1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions exceptions.fs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

\ NOTE ON THE IMPLEMENTATION:
\ Exception handling relies on the couple of words CATCH...THROW.
\ CATCH installs an exception handler and THROW signal an exception,
\ CATCH installs an exception handler and THROW signals an exception,
\ jumping to the innermost exception handler. The stack is unwinded
\ in CATCH time. Hence, we can access to the context of signal and
\ display useful debugging information (e.g: backtraces).
Expand All @@ -36,7 +36,7 @@ variable exception-handler
exception-handler-previous exception-handler ! ;

: %throw ( n -- )
>r exception-handler-sp sp! r>
dup if >r exception-handler-sp sp! r> then
exception-handler-target jump ;

: %catch-without-unwind ( xt -- )
Expand Down

0 comments on commit 511a7a1

Please sign in to comment.