[m-dev.] for review: fix type specialization

Simon Taylor stayl at cs.mu.OZ.AU
Fri Sep 8 22:33:35 AEDT 2000


> > @@ -2578,7 +2580,9 @@
> >  
> >  	hlds_out__write_indent(Indent),
> >  	io__write_string("% Constraints: "),
> > -	io__write_list(Constraints, ", ",  mercury_output_constraint(VarSet)),
> > +	{ AppendVarnums = no },
> > +	io__write_list(Constraints, ", ",
> > +		mercury_output_constraint(VarSet, AppendVarnums)),
> 
> Why do you set AppendVarnums to `no' here,
> rather than checking whether 'v' is set in dump_hlds_options?
> 
> Likewise for all of the other places where you set AppendVarnums = no.
> 
> Apart from that, this change looks fine.

--- hlds_out.m	2000/09/08 10:34:51	1.1
+++ hlds_out.m	2000/09/08 11:19:22
@@ -768,7 +768,7 @@
 			[]
 		;
 			hlds_out__write_constraint_proofs(Indent, TVarSet,
-				Proofs),
+				Proofs, AppendVarnums),
 			io__write_string("\n")
 		),
 
@@ -2569,18 +2569,20 @@
 		[]
 	),
 
-		% curry the varset for term_io__write_variable/4
-	{ PrintVar = lambda([VarName::in, IO0::di, IO::uo] is det,
-			term_io__write_variable(VarName, VarSet, IO0, IO)
-		) },
+	globals__io_lookup_string_option(dump_hlds_options, Verbose),
+	( { string__contains_char(Verbose, 'v') } ->
+		{ AppendVarnums = yes }
+	;
+		{ AppendVarnums = no }
+	),
+
 	hlds_out__write_indent(Indent),
 	io__write_string("% Vars: "),
-	io__write_list(Vars, ", ", PrintVar),
+	mercury_output_vars(Vars, VarSet, AppendVarnums),
 	io__nl,
 
 	hlds_out__write_indent(Indent),
 	io__write_string("% Constraints: "),
-	{ AppendVarnums = no },
 	io__write_list(Constraints, ", ",
 		mercury_output_constraint(VarSet, AppendVarnums)),
 	io__nl,
@@ -2707,18 +2709,25 @@
 		[]
 	),
 
+	globals__io_lookup_string_option(dump_hlds_options, Verbose),
+	( { string__contains_char(Verbose, 'v') } ->
+		{ AppendVarnums = yes }
+	;
+		{ AppendVarnums = no }
+	),
+
 		% curry the varset for term_io__write_variable/4
 	{ PrintTerm = lambda([TypeName::in, IO0::di, IO::uo] is det,
-			term_io__write_term(VarSet, TypeName, IO0, IO)
+			mercury_output_term(TypeName, VarSet,
+				AppendVarnums, IO0, IO)
 		) },
 	hlds_out__write_indent(Indent),
 	io__write_string("% Types: "),
 	io__write_list(Types, ", ", PrintTerm),
 	io__nl,
-
+		
 	hlds_out__write_indent(Indent),
 	io__write_string("% Constraints: "),
-	{ AppendVarnums = no },
 	io__write_list(Constraints, ", ", 
 		mercury_output_constraint(VarSet, AppendVarnums)),
 	io__nl,
@@ -2741,7 +2750,8 @@
 		[]
 	),
 
-	hlds_out__write_constraint_proofs(Indent, VarSet, Proofs),
+	hlds_out__write_constraint_proofs(Indent,
+		VarSet, Proofs, AppendVarnums),
 	io__nl.
 
 %-----------------------------------------------------------------------------%
@@ -3010,24 +3020,25 @@
 
 %-----------------------------------------------------------------------------%
 :- pred hlds_out__write_constraint_proofs(int, tvarset,
-	map(class_constraint, constraint_proof), io__state, io__state).
-:- mode hlds_out__write_constraint_proofs(in, in, in, di, uo) is det.
+	map(class_constraint, constraint_proof), bool, io__state, io__state).
+:- mode hlds_out__write_constraint_proofs(in, in, in, in, di, uo) is det.
 
-hlds_out__write_constraint_proofs(Indent, VarSet, Proofs) -->
+hlds_out__write_constraint_proofs(Indent, VarSet, Proofs, AppendVarnums) -->
 	hlds_out__write_indent(Indent),
 	io__write_string("% Proofs: \n"),
 	{ map__to_assoc_list(Proofs, ProofsList) },
 	io__write_list(ProofsList, "\n",
-		hlds_out__write_constraint_proof(Indent, VarSet)).
+		hlds_out__write_constraint_proof(Indent,
+			VarSet, AppendVarnums)).
 
-:- pred hlds_out__write_constraint_proof(int, tvarset,
+:- pred hlds_out__write_constraint_proof(int, tvarset, bool,
 	pair(class_constraint, constraint_proof), io__state, io__state).
-:- mode hlds_out__write_constraint_proof(in, in, in, di, uo) is det.
+:- mode hlds_out__write_constraint_proof(in, in, in, in, di, uo) is det.
 
-hlds_out__write_constraint_proof(Indent, VarSet, Constraint - Proof) -->
+hlds_out__write_constraint_proof(Indent, VarSet, AppendVarnums,
+		Constraint - Proof) -->
 	hlds_out__write_indent(Indent),
 	io__write_string("% "),
-	{ AppendVarnums = no },
 	mercury_output_constraint(VarSet, AppendVarnums, Constraint),
 	io__write_string(": "),
 	(
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list