[m-rev.] trivial diff: minor style cleanups

Julien Fischer juliensf at csse.unimelb.edu.au
Wed Nov 14 15:24:17 AEDT 2007


Estimated hours taken: 0.2
Branches: main

compiler/add_type.m:
compiler/recompilation.usage.m:
compiler/rtti_out.m:
 	Replaces some if-then-elses with switches.

 	Use svmulti_map.set/4 in preference to multi_map.set/4
 	in the presence of state variables.

Julien.

Index: add_type.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/add_type.m,v
retrieving revision 1.28
diff -u -r1.28 add_type.m
--- add_type.m	25 Sep 2007 04:56:37 -0000	1.28
+++ add_type.m	14 Nov 2007 04:21:07 -0000
@@ -74,6 +74,7 @@
  :- import_module multi_map.
  :- import_module string.
  :- import_module svmap.
+:- import_module svmulti_map.
  :- import_module term.

  %-----------------------------------------------------------------------------%
@@ -688,11 +689,12 @@
      ( QualifiedConsId = cons(qualified(Module, ConsName), Arity) ->
          % Add the unqualified version of the cons_id to the cons_table,
          % if appropriate.
-        ( NeedQual = may_be_unqualified ->
+        (
+            NeedQual = may_be_unqualified,
              UnqualifiedConsId = cons(unqualified(ConsName), Arity),
-            multi_map.set(!.Ctors, UnqualifiedConsId, ConsDefn, !:Ctors)
+            svmulti_map.set(UnqualifiedConsId, ConsDefn, !Ctors)
          ;
-            true
+            NeedQual = must_be_qualified
          ),

          % Add partially qualified versions of the cons_id.
@@ -788,11 +790,12 @@

          % Add an unqualified version of the field name to the table,
          % if appropriate.
-        ( NeedQual = may_be_unqualified ->
-            multi_map.set(!.FieldNameTable, unqualified(UnqualFieldName),
-                FieldDefn, !:FieldNameTable)
+        (
+            NeedQual = may_be_unqualified,
+            svmulti_map.set(unqualified(UnqualFieldName), FieldDefn,
+                !FieldNameTable)
          ;
-            true
+            NeedQual = must_be_qualified
          ),

          % Add partially qualified versions of the cons_id
@@ -804,8 +807,8 @@
      module_name::in, ctor_field_table::in, ctor_field_table::out) is det.

  do_add_ctor_field(FieldName, FieldNameDefn, ModuleName, !FieldNameTable) :-
-    multi_map.set(!.FieldNameTable, qualified(ModuleName, FieldName),
-        FieldNameDefn, !:FieldNameTable).
+    svmulti_map.set(qualified(ModuleName, FieldName), FieldNameDefn,
+        !FieldNameTable).

  %----------------------------------------------------------------------------%

Index: recompilation.usage.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/recompilation.usage.m,v
retrieving revision 1.44
diff -u -r1.44 recompilation.usage.m
--- recompilation.usage.m	25 Sep 2007 04:56:41 -0000	1.44
+++ recompilation.usage.m	14 Nov 2007 04:21:07 -0000
@@ -240,9 +240,11 @@
      io.write_string(Suffix, !IO),
      io.write_string(""", ", !IO),
      write_version_number(ModuleTimestamp, !IO),
-    ( NeedQualifier = must_be_qualified ->
+    (
+        NeedQualifier = must_be_qualified,
          io.write_string(", used)", !IO)
      ;
+        NeedQualifier = may_be_unqualified,
          io.write_string(")", !IO)
      ),
      (
Index: rtti_out.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/rtti_out.m,v
retrieving revision 1.75
diff -u -r1.75 rtti_out.m
--- rtti_out.m	11 Sep 2007 03:12:33 -0000	1.75
+++ rtti_out.m	14 Nov 2007 04:21:07 -0000
@@ -118,6 +118,7 @@
  :- import_module multi_map.
  :- import_module pair.
  :- import_module string.
+:- import_module svmulti_map.
  :- import_module univ.

  %-----------------------------------------------------------------------------%
@@ -1368,7 +1369,7 @@
          rtti_id_c_type(RttiId, CType, IsArray),
          rtti_id_linkage(RttiId, Linkage),
          Group = data_group(CType, IsArray, Linkage),
-        multi_map.set(!.GroupMap, Group, RttiId, !:GroupMap)
+        svmulti_map.set(Group, RttiId, !GroupMap)
      ),
      classify_rtti_datas_to_decl(RttiDatas, !GroupMap).


--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list