[m-rev.] for review: Bug fix for enumerated type switch statements in Java

James Goddard goddardjames at yahoo.com
Tue Dec 23 14:15:30 AEDT 2003


Estimated hours taken: 4
Branches: main

Bug fix for enumerated type switch statements in Java.

compiler/mlds_to_java.m:
	Modified rval_is_enum_object/1 so that it considers field selections
	as well as vars.
	This fixes a problem that arose in producing the switch statement for
	fold_bits/7 in library/sparse_bitset, where the enumerated type was
	not detected, so it was trying to switch on an Object:

	(mercury.sparse_bitset.fold_bits_7_p_3_env_0) env_ptr).Dir_8

	as opposed to:

	(mercury.sparse_bitset.fold_bits_7_p_3_env_0) env_ptr).Dir_8.value

	which is what it should have.

Index: mlds_to_java.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mlds_to_java.m,v
retrieving revision 1.49
diff -u -d -r1.49 mlds_to_java.m
--- mlds_to_java.m	22 Dec 2003 23:37:33 -0000	1.49
+++ mlds_to_java.m	23 Dec 2003 03:07:13 -0000
@@ -213,7 +213,11 @@
 
 rval_is_enum_object(Rval) :-
 		Rval = lval(Lval),
-		Lval = var(_, VarType),
+		(
+			Lval = var(_, VarType)
+		;
+			Lval = field(_, _, _, VarType, _)
+		),
 		type_is_enum(VarType).
 
 	% Succeeds iff a given string matches the unqualified

--------------------------------------------------------------------------
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