hlds_out.m bug fixes

Fergus Henderson fjh at cs.mu.OZ.AU
Mon Feb 2 15:18:56 AEDT 1998


compiler/hlds_out.m:
	Fix some bugs:
	- output of higher-order pred calls and higher-order function
	  applications was missing a newline
	- output of higher-order function applications was missing
	  the higher-order function variable
	- the code to output purity annotations on calls was aborting
	  for calls with invalid pred_ids (i.e. all of them, for
	  HLDS dumps before type checking).

Index: hlds_out.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/hlds_out.m,v
retrieving revision 1.185
diff -u -u -r1.185 hlds_out.m
--- hlds_out.m	1998/01/29 13:31:40	1.185
+++ hlds_out.m	1998/02/02 04:12:14
@@ -987,7 +987,7 @@
 	hlds_out__write_indent(Indent),
 	(	{ PredOrFunc = predicate },
 		( { string__contains_char(Verbose, 'l') } ->
-			io__write_string("% higher-order predicate call"),
+			io__write_string("% higher-order predicate call\n"),
 			hlds_out__write_indent(Indent)
 		;
 			[]
@@ -997,12 +997,14 @@
 	;
 		{ PredOrFunc = function },
 		( { string__contains_char(Verbose, 'l') } ->
-			io__write_string("% higher-order function application"),
+			io__write_string(
+				"% higher-order function application\n"),
 			hlds_out__write_indent(Indent)
 		;
 			[]
 		),
-		{ pred_args_to_func_args(ArgVars, FuncArgVars, FuncRetVar) },
+		{ pred_args_to_func_args([PredVar | ArgVars],
+			FuncArgVars, FuncRetVar) },
 		mercury_output_var(FuncRetVar, VarSet, AppendVarnums),
 		io__write_string(" = "),
 		hlds_out__write_functor(term__atom("apply"), FuncArgVars,
@@ -1047,9 +1049,13 @@
 		[]
 	),
 	hlds_out__write_indent(Indent),
-	{ module_info_pred_info(ModuleInfo, PredId, PredInfo) },
-	{ pred_info_get_purity(PredInfo, Purity) },
-	write_purity_prefix(Purity),
+	( { invalid_pred_id(PredId)} ->
+		[]
+	;
+		{ module_info_pred_info(ModuleInfo, PredId, PredInfo) },
+		{ pred_info_get_purity(PredInfo, Purity) },
+		write_purity_prefix(Purity)
+	),
 	(
 		{ PredName = qualified(ModuleName, Name) },
 		hlds_out__write_qualified_functor(ModuleName, term__atom(Name),

-- 
Fergus Henderson <fjh at cs.mu.oz.au>   |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>   |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3         |     -- the last words of T. S. Garp.



More information about the developers mailing list