check for unbound calls (#154)
This commit is contained in:
parent
f08d8b4b04
commit
2d6934178b
@ -66,9 +66,21 @@ setup_call_cleanup(Setup, Goal, Cleanup) :-
|
|||||||
|
|
||||||
setup_call_catcher_cleanup(Setup, Goal, Catcher, Cleanup) :-
|
setup_call_catcher_cleanup(Setup, Goal, Catcher, Cleanup) :-
|
||||||
yap_hacks:disable_interrupts,
|
yap_hacks:disable_interrupts,
|
||||||
|
'$check_goal_for_setup_call_cleanup'(Setup, setup_call_catcher_cleanup(Setup, Goal, Catcher, Cleanup)),
|
||||||
'$do_setup'(Setup),
|
'$do_setup'(Setup),
|
||||||
|
'$check_goal_for_setup_call_cleanup'(Cleanup, setup_call_catcher_cleanup(Setup, Goal, Catcher, Cleanup)),
|
||||||
'$safe_call_cleanup'(Goal,Cleanup,Catcher,Exception).
|
'$safe_call_cleanup'(Goal,Cleanup,Catcher,Exception).
|
||||||
|
|
||||||
|
'$check_goal_for_setup_call_cleanup'(Goal, G) :-
|
||||||
|
strip_module(Goal, _, MG),
|
||||||
|
(
|
||||||
|
var(MG)
|
||||||
|
->
|
||||||
|
'$do_error'(instantiation_error,G)
|
||||||
|
;
|
||||||
|
true
|
||||||
|
).
|
||||||
|
|
||||||
% this is simple, do nothing
|
% this is simple, do nothing
|
||||||
'$do_setup'(A:true) :- atom(A), !.
|
'$do_setup'(A:true) :- atom(A), !.
|
||||||
% this is tricky: please don't forget that interrupts are disabled at this point
|
% this is tricky: please don't forget that interrupts are disabled at this point
|
||||||
|
Reference in New Issue
Block a user