[m-rev.] [dotnet-foreign] diff: fix sym_name to class_name problem.

Peter Ross peter.ross at miscrit.be
Fri Apr 20 23:38:38 AEST 2001


Hi,


===================================================================


Estimated hours taken: 0.2
Branches: dotnet-foreign

compiler/mlds_to_il.m:
    Fix a bug where foreign types where having `mercury_code' added to
    their name incorrectly.


Index: compiler/mlds_to_il.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/mlds_to_il.m,v
retrieving revision 1.15.4.8
diff -u -r1.15.4.8 mlds_to_il.m
--- compiler/mlds_to_il.m	2001/04/13 07:46:39	1.15.4.8
+++ compiler/mlds_to_il.m	2001/04/20 13:35:54
@@ -1817,7 +1817,7 @@
 
 mlds_type_to_ilds_type(mlds__foreign_type(ForeignType, Assembly))
 	= ilds__type([], Class) :-
-	sym_name_to_class_name(ForeignType, ForeignClassName),
+	sym_name_to_class_name(ForeignType, no, ForeignClassName),
 	Class = class(structured_name(Assembly, ForeignClassName)).
 	
 
@@ -2054,7 +2054,7 @@
 mlds_module_name_to_class_name(MldsModuleName) = 
 		structured_name(AssemblyName, ClassName) :-
 	SymName = mlds_module_name_to_sym_name(MldsModuleName),
-	sym_name_to_class_name(SymName, ClassName),
+	sym_name_to_class_name(SymName, yes, ClassName),
 	( 
 		ClassName = ["mercury" | _]
 	->
@@ -2063,11 +2063,18 @@
 		mlds_to_il__sym_name_to_string(SymName, AssemblyName)
 	).
 
-:- pred sym_name_to_class_name(sym_name, list(ilds__id)).
-:- mode sym_name_to_class_name(in, out) is det.
-sym_name_to_class_name(SymName, Ids) :-
+:- pred sym_name_to_class_name(sym_name, bool, list(ilds__id)).
+:- mode sym_name_to_class_name(in, in, out) is det.
+sym_name_to_class_name(SymName, AddMercuryCode, Ids) :-
 	sym_name_to_class_name_2(SymName, Ids0),
-	list__reverse(["mercury_code" | Ids0], Ids).
+	(
+		AddMercuryCode = yes,
+		Ids1 = ["mercury_code" | Ids0]
+	;
+		AddMercuryCode = no,
+		Ids1 = Ids0
+	),
+	list__reverse(Ids1, Ids).
 
 :- pred sym_name_to_class_name_2(sym_name, list(ilds__id)).
 :- mode sym_name_to_class_name_2(in, out) is det.

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