[m-rev.] Diff: Another bug fix for outputting enumerated type casts in Java

James Goddard goddardjames at yahoo.com
Fri Feb 20 18:15:45 AEDT 2004


Estimated hours taken: 2
Branches: main

Bug fix for casting enumerated types.

compiler/mlds_to_java.m:
	Removed the ".value" suffix for expressions of the form:

		(Type) Thing.value

	except for the case where Type is int.


Index: mlds_to_java.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mlds_to_java.m,v
retrieving revision 1.52
diff -u -d -r1.52 mlds_to_java.m
--- mlds_to_java.m	16 Feb 2004 03:52:44 -0000	1.52
+++ mlds_to_java.m	20 Feb 2004 06:55:43 -0000
@@ -3071,7 +3071,11 @@
 	io__write_string("("),
 	output_type(Type),
 	io__write_string(") "),
-	output_rval_maybe_with_enum(Exprn, ModuleName).
+	( { java_builtin_type(Type, "int", _, _) } ->
+		output_rval_maybe_with_enum(Exprn, ModuleName)
+	;
+		output_rval(Exprn, ModuleName)
+	).
 
 :- pred output_boxed_rval(mlds__type, mlds__rval, mlds_module_name,
 		io__state, io__state).
--------------------------------------------------------------------------
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