support exception/3 on undefined predicates.
This commit is contained in:
parent
192aa92b9c
commit
8cfbee9584
19
pl/boot.yap
19
pl/boot.yap
@ -965,6 +965,25 @@ not(G) :- \+ '$execute'(G).
|
||||
'$execute0'(G, CurMod)
|
||||
).
|
||||
|
||||
'$find_undefp_handler'(G,M,NG,user) :-
|
||||
functor(G, Na, Ar),
|
||||
user:exception(undefined_predicate,M:Na/Ar,Action), !,
|
||||
'$exit_undefp',
|
||||
(
|
||||
Action == fail
|
||||
->
|
||||
NG = fail
|
||||
;
|
||||
Action == retry
|
||||
->
|
||||
NG = G
|
||||
;
|
||||
Action = error
|
||||
->
|
||||
'$unknown_error'(M:G)
|
||||
;
|
||||
'$do_error'(type_error(atom, Action),M:G)
|
||||
).
|
||||
'$find_undefp_handler'(G,M,NG,user) :-
|
||||
\+ '$undefined'(unknown_predicate_handler(_,_,_), user),
|
||||
'$system_catch'(unknown_predicate_handler(G,M,NG), user, Error, '$leave_undefp'(Error)), !,
|
||||
|
Reference in New Issue
Block a user