[m-rev.] diff: fix write_pred_id
Zoltan Somogyi
zs at cs.mu.OZ.AU
Wed Feb 9 18:43:23 AEDT 2005
For both branches.
Zoltan.
compiler/hlds_out.m:
Fix a bug: when printing pred_ids, don't insist on the pred_id
referring to a currently defined predicate. This is needed, because
when printing the origin of a transformed predicate, the original
predicate may have been deleted as dead.
Index: hlds_out.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/hlds_out.m,v
retrieving revision 1.347
diff -u -b -r1.347 hlds_out.m
--- hlds_out.m 2 Feb 2005 02:58:41 -0000 1.347
+++ hlds_out.m 9 Feb 2005 05:06:16 -0000
@@ -350,7 +350,8 @@
% there as well.
hlds_out__write_pred_id(ModuleInfo, PredId, !IO) :-
- module_info_pred_info(ModuleInfo, PredId, PredInfo),
+ module_info_preds(ModuleInfo, PredTable),
+ ( map__search(PredTable, PredId, PredInfo) ->
Module = pred_info_module(PredInfo),
Name = pred_info_name(PredInfo),
Arity = pred_info_orig_arity(PredInfo),
@@ -372,15 +373,23 @@
pred_info_get_markers(PredInfo, Markers),
check_marker(Markers, class_instance_method)
->
- io__write_string("type class method implementation", !IO)
+ io__write_string("type class method implementation",
+ !IO)
;
pred_info_get_goal_type(PredInfo, promise(PromiseType))
->
- io__write_string("`" ++ prog_out__promise_to_string(PromiseType)
+ io__write_string("`" ++
+ prog_out__promise_to_string(PromiseType)
++ "' declaration", !IO)
;
hlds_out__write_simple_call_id(PredOrFunc,
qualified(Module, Name), Arity, !IO)
+ )
+ ;
+ % The predicate has been deleted, so we print what we can.
+ pred_id_to_int(PredId, PredIdInt),
+ io__write_string("deleted predicate ", !IO),
+ io__write_int(PredIdInt, !IO)
).
hlds_out__write_pred_proc_id(ModuleInfo, PredId, ProcId, !IO) :-
--------------------------------------------------------------------------
mercury-reviews mailing list
post: mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the reviews
mailing list