make expand_goal built-in.

This commit is contained in:
Vitor Santos Costa 2010-02-28 22:25:54 +00:00
parent 16a9c8a807
commit dcd1c37fa8
2 changed files with 22 additions and 14 deletions

View File

@ -939,8 +939,6 @@ not(G) :- \+ '$execute'(G).
'$check_callable'(_,_).
% Called by the abstract machine, if no clauses exist for a predicate
'$undefp'([M|expand_goal(G,GEx)]) :- !,
G = GEx.
'$undefp'([M|G]) :-
% make sure we do not loop on undefined predicates
% for undefined_predicates.

View File

@ -297,6 +297,27 @@ module(N) :-
'$module_expansion'(M:G,G1,GO,_,CM,_,HVars) :- !,
'$module_expansion'(G,G1,GO,M,M,HM,HVars).
'$module_expansion'(G, G1, GO, CurMod, MM, HM, HVars) :-
'$do_expand'(CurMod:G, CurMod:GI), !,
'$module_expansion'(GI, G1, GO, CurMod, MM, HM, HVars).
'$module_expansion'(G, G1, GO, CurMod, MM, HM,HVars) :-
% is this imported from some other module M1?
'$imported_pred'(G, CurMod, GG, M1),
!,
'$module_expansion'(GG, G1, GO, M1, MM, HM,HVars).
'$module_expansion'(G, G1, GO, CurMod, MM, HM,HVars) :-
'$meta_expansion'(G, CurMod, MM, HM, GI, HVars), !,
'$complete_goal_expansion'(GI, CurMod, MM, HM, G1, GO, HVars).
'$module_expansion'(G, G1, GO, CurMod, MM, HM, HVars) :-
'$complete_goal_expansion'(G, CurMod, MM, HM, G1, GO, HVars).
expand_goal(G, NG) :-
'$current_module'(Mod),
'$do_expand'(G, M, NG), !.
expand_goal(M:G, M:NG) :-
'$do_expand'(G, M, NG), !.
expand_goal(G, G).
'$do_expand'(G, CurMod, NG) :-
'$pred_goal_expansion_on',
( user:goal_expansion(G, CurMod, GI)
->
@ -309,18 +330,7 @@ module(N) :-
)
;
user:goal_expansion(G, GI)
), !,
'$module_expansion'(GI, G1, GO, CurMod, MM, HM, HVars).
'$module_expansion'(G, G1, GO, CurMod, MM, HM,HVars) :-
% is this imported from some other module M1?
'$imported_pred'(G, CurMod, GG, M1),
!,
'$module_expansion'(GG, G1, GO, M1, MM, HM,HVars).
'$module_expansion'(G, G1, GO, CurMod, MM, HM,HVars) :-
'$meta_expansion'(G, CurMod, MM, HM, GI, HVars), !,
'$complete_goal_expansion'(GI, CurMod, MM, HM, G1, GO, HVars).
'$module_expansion'(G, G1, GO, CurMod, MM, HM, HVars) :-
'$complete_goal_expansion'(G, CurMod, MM, HM, G1, GO, HVars).
).
% args are:
% goal to expand