follow import recursively so that we don't lose properties like being a

meta predicate.
This commit is contained in:
Vitor Santos Costa 2009-12-03 16:33:44 +00:00
parent 742979eb9c
commit bc4b718afb
3 changed files with 21 additions and 11 deletions

View File

@ -904,19 +904,13 @@ not(G) :- \+ '$execute'(G).
'$undefp'([M|G]) :-
% make sure we do not loop on undefined predicates
% for undefined_predicates.
'$enter_undefp',
(
recorded('$import','$import'(NM,M,Goal,G,_,_),_)
'$imported_predicate'(NM,M,Goal,G)
->
true
'$exit_undefp'
;
'$enter_undefp',
(
swi:swi_predicate_table(M,G,NM,Goal)
->
'$exit_undefp'
;
once('$find_undefp_handler'(G,M,Goal,NM))
)
once('$find_undefp_handler'(G,M,Goal,NM))
),
!,
Goal \= fail,

View File

@ -368,6 +368,22 @@ module(N) :-
'$exit_undefp',
fail.
%
% get all imported predicates
%
'$imported_predicate'(FM,Mod,FPred,Pred) :-
recorded('$import','$import'(IM,Mod,IPred,Pred,_,_),_),
'$continue_imported'(FM, IM, FPred, IPred).
'$imported_predicate'(FM,Mod,FPred,Pred) :-
swi:swi_predicate_table(Mod,Pred,IM,IPred),
'$continue_imported'(FM, IM, FPred, IPred).
'$continue_imported'(FM,Mod,FPred,Pred) :-
recorded('$import','$import'(IM,Mod,IPred,Pred,_,_),_), !,
'$continue_imported'(FM, IM, FPred, IPred).
'$continue_imported'(Mod,Mod,Pred,Pred).
% module_transparent declaration
%

View File

@ -798,7 +798,7 @@ predicate_property(Pred,Prop) :-
'$pred_exists'(Pred,Mod), !,
'$predicate_property'(Pred,Mod,Mod,Prop).
'$predicate_property2'(Pred,Prop,Mod) :-
recorded('$import','$import'(M,Mod,NPred,Pred,_,_),_),
'$imported_predicate'(M,Mod,NPred,Pred),
(
Prop = imported_from(M)
;