[m-rev.] trivial diff: java back-end: make output tidier
Fergus Henderson
fjh at cs.mu.OZ.AU
Fri Feb 15 19:16:45 AEDT 2002
Estimated hours taken: 0.25
Branches: main
compiler/mlds_to_java.m:
Add more whitespace in the output generated for class definitions:
put the `extends ...' and `implements ...' parts on lines of
their own.
Workspace: /home/ceres/fjh/mercury
Index: compiler/mlds_to_java.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mlds_to_java.m,v
retrieving revision 1.22
diff -u -d -r1.22 mlds_to_java.m
--- compiler/mlds_to_java.m 11 Feb 2002 11:27:09 -0000 1.22
+++ compiler/mlds_to_java.m 14 Feb 2002 07:47:13 -0000
@@ -1030,10 +1030,11 @@
;
io__write_string("class ")
),
- output_class_name(UnqualName),
- output_extends_list(BaseClasses),
- output_implements_list(Implements),
- io__write_string(" {\n"),
+ output_class_name(UnqualName), io__nl,
+ output_extends_list(Indent + 1, BaseClasses),
+ output_implements_list(Indent + 1, Implements),
+ indent_line(Indent),
+ io__write_string("{\n"),
output_class_body(Indent + 1, Kind, Name, AllMembers, ModuleName),
io__nl,
output_defns(Indent + 1, ModuleName, cname(UnqualName), Ctors),
@@ -1044,29 +1045,33 @@
% not support multiple inheritance, so more than one superclass
% is an error.
%
-:- pred output_extends_list(list(mlds__class_id), io__state, io__state).
-:- mode output_extends_list(in, di, uo) is det.
+:- pred output_extends_list(indent, list(mlds__class_id), io__state, io__state).
+:- mode output_extends_list(in, in, di, uo) is det.
-output_extends_list([]) --> [].
-output_extends_list([SuperClass]) -->
- io__write_string(" extends "),
- output_type(SuperClass).
-output_extends_list([_, _ | _]) -->
+output_extends_list(_, []) --> [].
+output_extends_list(Indent, [SuperClass]) -->
+ indent_line(Indent),
+ io__write_string("extends "),
+ output_type(SuperClass),
+ io__nl.
+output_extends_list(_, [_, _ | _]) -->
{ unexpected(this_file,
"output_extends_list: multiple inheritance not supported in Java") }.
% Output list of interfaces that this class implements.
%
-:- pred output_implements_list(list(mlds__interface_id),
+:- pred output_implements_list(indent, list(mlds__interface_id),
io__state, io__state).
-:- mode output_implements_list(in, di, uo) is det.
+:- mode output_implements_list(in, in, di, uo) is det.
-output_implements_list(InterfaceList) -->
+output_implements_list(Indent, InterfaceList) -->
( { InterfaceList = [] } ->
[]
;
- io__write_string(" implements "),
- io__write_list(InterfaceList, ",", output_interface)
+ indent_line(Indent),
+ io__write_string("implements "),
+ io__write_list(InterfaceList, ",", output_interface) ,
+ io__nl
).
:- pred output_interface(mlds__interface_id, io__state, io__state).
--
Fergus Henderson <fjh at cs.mu.oz.au> | "I have always known that the pursuit
The University of Melbourne | of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp.
--------------------------------------------------------------------------
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