[m-dev.] diff: fix minor bug with nested modules

Fergus Henderson fjh at cs.mu.OZ.AU
Fri Jul 16 18:19:54 AEST 1999


Estimated hours taken: 0.5

compiler/modules.m:
	Fix a bug in the handling of the search for a file matching a given
	module name: if one of the names does not exist, but there are still
	more possibilities to search for, it should just print out
	"not found..." rather than printing out "error" and calling
	io__set_exit_status(1).

Workspace: /home/mercury0/fjh/mercury
Index: compiler/modules.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/modules.m,v
retrieving revision 1.101
diff -u -r1.101 modules.m
--- modules.m	1999/07/14 14:56:13	1.101
+++ modules.m	1999/07/16 08:15:45
@@ -2957,27 +2957,6 @@
 		Error0, ActualModuleName, Messages, Items0),
 	check_module_has_expected_name(FileName0,
 		ModuleName, ActualModuleName),
-	( { IgnoreErrors = yes } ->
-		(
-			{ Error0 = fatal },
-			{ Items0 = [] }
-		->
-			maybe_write_string(VeryVerbose, "not found.\n")
-		;
-			maybe_write_string(VeryVerbose, "done.\n")
-		)
-	;
-		( { Error0 = fatal } ->
-			maybe_write_string(VeryVerbose, "fatal error(s).\n"),
-			io__set_exit_status(1)
-		; { Error0 = yes } ->
-			maybe_write_string(VeryVerbose, "parse error(s).\n"),
-			io__set_exit_status(1)
-		;
-			maybe_write_string(VeryVerbose, "successful parse.\n")
-		),
-		prog_out__write_messages(Messages)
-	),
 	%
 	% if that didn't work, and we're reading in the source (.m)
 	% file for a nested module, try again after dropping one 
@@ -2989,10 +2968,35 @@
 		{ Extension = ".m" },
 		{ PartialModuleName = qualified(Parent, Child) }
 	->
+		maybe_write_string(VeryVerbose, "not found...\n"),
 		{ drop_one_qualifier(Parent, Child, PartialModuleName2) },
 		read_mod_2(IgnoreErrors, ModuleName, PartialModuleName2,
 			Extension, Descr, Search, Items, Error, FileName)
 	;
+		( { IgnoreErrors = yes } ->
+			(
+				{ Error0 = fatal },
+				{ Items0 = [] }
+			->
+				maybe_write_string(VeryVerbose, "not found.\n")
+			;
+				maybe_write_string(VeryVerbose, "done.\n")
+			)
+		;
+			( { Error0 = fatal } ->
+				maybe_write_string(VeryVerbose,
+					"fatal error(s).\n"),
+				io__set_exit_status(1)
+			; { Error0 = yes } ->
+				maybe_write_string(VeryVerbose,
+					"parse error(s).\n"),
+				io__set_exit_status(1)
+			;
+				maybe_write_string(VeryVerbose,
+					"successful parse.\n")
+			),
+			prog_out__write_messages(Messages)
+		),
 		{ Error = Error0 },
 		{ Items = Items0 },
 		{ FileName = FileName0 }

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