Merge branch 'master' of ssh://yap.git.sourceforge.net/gitroot/yap/yap-6.3

This commit is contained in:
Vítor Santos Costa 2012-03-28 17:55:06 +01:00
commit 32167b5465
3 changed files with 32 additions and 18 deletions

View File

@ -422,11 +422,17 @@ true :- true.
'$compile'(G, L, G0, Mod)
).
%
% check if current module redefines an imported predicate.
% and remove import.
%
'$not_imported'(H, Mod) :-
recorded('$import','$import'(NM,Mod,NH,H,_,_),_),
NM \= Mod, !,
recorded('$import','$import'(NM,Mod,NH,H,_,_),R),
NM \= Mod,
functor(NH,N,Ar),
'$do_error'(permission_error(modify, static_procedure, NM:N/Ar), consult).
print_message(warning,redefine_imported(Mod,NM,N/Ar)),
erase(R),
fail.
'$not_imported'(_, _).

View File

@ -126,6 +126,8 @@ system_message(functionality(Library)) -->
[ '~q not available' - [Library] ].
system_message(import(Pred,To,From,private)) -->
[ 'Importing private predicate ~w:~w to ~w.' - [From,Pred,To] ].
system_message(redefine_imported(M,M0,PI)) -->
[ 'Module ~w redefines imported predicate ~w:~w.' - [M,M0,PI] ].
system_message(leash([])) -->
[ 'No leashing.' ].
system_message(leash([A|B])) -->

View File

@ -154,6 +154,12 @@ module(N) :-
'$do_import'(N, K, M, Mod).
%
% ignore imports that we do export
%
'$do_import'(N, K, M, T) :-
recorded('$module','$module'(_F,T,MyExports),_),
lists:member(N/K,MyExports), !.
'$do_import'(N, K, M, T) :-
functor(G,N,K),
'$follow_import_chain'(M,G,M0,G0),
@ -169,7 +175,7 @@ module(N) :-
).
'$follow_import_chain'(M,G,M0,G0) :-
recorded('$import','$import'(M1,M,G1,G,_,_),_), !,
recorded('$import','$import'(M1,M,G1,G,_,_),_), M \= M1, !,
'$follow_import_chain'(M1,G1,M0,G0).
'$follow_import_chain'(M,G,M,G).