Updated the behavior of the call_cleanup/2-3 built-in predicates to match SWI-Prolog regarding handling of exceptions.

git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1890 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
pmoura 2007-05-27 21:40:17 +00:00
parent 7132173dbd
commit 24ade76e94
1 changed files with 5 additions and 2 deletions

View File

@ -191,8 +191,11 @@ call_cleanup(Goal, Catcher, Cleanup) :-
Exception,
'$cleanup_exception'(Exception,Catcher,Cleanup)).
'$cleanup_exception'(Exception, exception(Exception), Cleanup) :-
'$clean_call'(Cleanup).
'$cleanup_exception'(Exception, exception(Exception), Cleanup) :- !,
'$clean_call'(Cleanup),
throw(Exception).
'$cleanup_exception'(Exception, _, _) :-
throw(Exception).
'$call_cleanup'(Goal, Cleanup, Result) :-
'$freeze_goal'(Result, '$clean_call'(Cleanup)),