[m-dev.] diff: MLDS back-end: fix bug with nested modules
Fergus Henderson
fjh at cs.mu.OZ.AU
Tue May 16 03:30:56 AEST 2000
Estimated hours taken: 0.25
Fix a bug in the handling of nested modules for the MLDS back-end.
This bug broke the test cases in tests/hard_coded/nested_modules.
compiler/ml_code_gen.m:
Include the ancestor modules in the MLDS import list (which is
used by mlds_to_c.m to determine which files to #include).
compiler/modules.m:
Update the dependency calculation to reflect the above change.
Workspace: /home/pgrad/fjh/ws/hg
Index: compiler/ml_code_gen.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/ml_code_gen.m,v
retrieving revision 1.41
diff -u -d -r1.41 ml_code_gen.m
--- compiler/ml_code_gen.m 2000/05/13 13:56:15 1.41
+++ compiler/ml_code_gen.m 2000/05/15 17:20:26
@@ -665,7 +665,7 @@
:- import_module export, llds_out. % XXX needed for pragma C code
:- import_module hlds_pred, hlds_goal, hlds_data, prog_data.
:- import_module goal_util, type_util, mode_util, builtin_ops.
-:- import_module passes_aux.
+:- import_module passes_aux, modules.
:- import_module bool, string, list, map, set, require, std_util.
@@ -701,10 +701,13 @@
:- mode ml_gen_imports(in, out) is det.
ml_gen_imports(ModuleInfo, MLDS_ImportList) :-
+ module_info_name(ModuleInfo, ModuleName),
+ get_ancestors(ModuleName, Parents),
module_info_get_imported_module_specifiers(ModuleInfo, DirectImports),
module_info_get_indirectly_imported_module_specifiers(ModuleInfo,
IndirectImports),
- AllImports = DirectImports `set__union` IndirectImports,
+ AllImports = (IndirectImports `set__union` DirectImports)
+ `set__union` set__list_to_set(Parents),
MLDS_ImportList = list__map(mercury_module_name_to_mlds,
set__to_sorted_list(AllImports)).
Index: compiler/modules.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/modules.m,v
retrieving revision 1.121
diff -u -d -r1.121 modules.m
--- compiler/modules.m 2000/05/15 03:33:01 1.121
+++ compiler/modules.m 2000/05/15 17:22:13
@@ -1558,12 +1558,14 @@
; { Result = ok(DepStream) },
{ list__append(IntDeps, ImplDeps, LongDeps0) },
{ ShortDeps0 = IndirectDeps },
+ { set__list_to_set(ParentDeps, ParentDepsSet) },
{ set__list_to_set(LongDeps0, LongDepsSet0) },
{ set__delete(LongDepsSet0, ModuleName, LongDepsSet) },
{ set__list_to_set(ShortDeps0, ShortDepsSet0) },
{ set__difference(ShortDepsSet0, LongDepsSet, ShortDepsSet1) },
{ set__delete(ShortDepsSet1, ModuleName, ShortDepsSet) },
- { set__union(LongDepsSet, ShortDepsSet, AllDepsSet) },
+ { AllDepsSet = (ShortDepsSet `set__union` LongDepsSet)
+ `set__union` ParentDepsSet },
{ set__to_sorted_list(LongDepsSet, LongDeps) },
{ set__to_sorted_list(ShortDepsSet, ShortDeps) },
{ set__to_sorted_list(AllDepsSet, AllDeps) },
--
Fergus Henderson <fjh at cs.mu.oz.au> | "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh> | of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3 | -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to: mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions: mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------
More information about the developers
mailing list