[m-rev.] [dotnet-foreign] diff: set imports for foreign_types

Peter Ross peter.ross at miscrit.be
Wed Apr 11 22:51:45 AEST 2001


Hi,


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


Estimated hours taken: 1
Branches: dotnet-foreign

compiler/ml_code_gen.m:
    Add the modules specified in the foreign_type pragmas to the list of
    imports for the module.


Index: ml_code_gen.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/ml_code_gen.m,v
retrieving revision 1.80.2.1
diff -u -r1.80.2.1 ml_code_gen.m
--- ml_code_gen.m	2001/04/09 14:08:16	1.80.2.1
+++ ml_code_gen.m	2001/04/11 12:48:36
@@ -817,8 +817,16 @@
 
 ml_gen_imports(ModuleInfo, MLDS_ImportList) :-
 	module_info_get_all_deps(ModuleInfo, AllImports),
-	MLDS_ImportList = list__map(mercury_module_name_to_mlds,
-		set__to_sorted_list(AllImports)).
+	module_info_types(ModuleInfo, Types),
+	list__filter_map((pred(TypeDefn::in, Import::out) is semidet :-
+			hlds_data__get_type_defn_body(TypeDefn, Body),
+			Body = foreign_type(_, Location),
+			Import = mercury_module_name_to_mlds(
+					unqualified(Location))
+		), map__values(Types), ForeignTypeImports),
+	MLDS_ImportList = ForeignTypeImports ++ 
+			list__map(mercury_module_name_to_mlds,
+					set__to_sorted_list(AllImports)).
 
 :- pred ml_gen_defns(module_info, mlds__defns, io__state, io__state).
 :- mode ml_gen_defns(in, out, di, uo) 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