[m-rev.] diff: delete a duplicate predicate

Julien Fischer jfischer at opturion.com
Mon Apr 10 13:18:42 AEST 2017


Delete a duplicate predicate.

compiler/prog_data.m:
compiler/prog_out.m:
     Both of these module define a predicate equivalent to
     builtin_type_to_string/2; define it only prog_data.m.

compiler/prog_event.m:
compiler/parse_tree_to_term.m:
     Delete imports of parse_tree.prog_out; they are no longer
     required.

Julien

diff --git a/compiler/parse_tree_to_term.m b/compiler/parse_tree_to_term.m
index 846fb00..568c9a6 100644
--- a/compiler/parse_tree_to_term.m
+++ b/compiler/parse_tree_to_term.m
@@ -43,7 +43,6 @@
  :- import_module mdbcomp.
  :- import_module mdbcomp.prim_data.
  :- import_module mdbcomp.sym_name.
-:- import_module parse_tree.prog_out.
  :- import_module parse_tree.prog_util.

  :- import_module list.
diff --git a/compiler/prog_data.m b/compiler/prog_data.m
index eeb14d6..8b5846c 100644
--- a/compiler/prog_data.m
+++ b/compiler/prog_data.m
@@ -503,6 +503,10 @@ cons_id_is_const_struct(ConsId, ConstNum) :-

  :- pred is_builtin_type_name(string::in) is semidet.

+:- pred builtin_type_to_string(builtin_type, string).
+:- mode builtin_type_to_string(in, out) is det.
+:- mode builtin_type_to_string(out, in) is semidet.
+
  :- type type_term == term(tvar_type).

  :- type tvar_type
@@ -550,20 +554,16 @@ cons_id_is_const_struct(ConsId, ConstNum) :-

  is_builtin_type_sym_name(SymName) :-
      SymName = unqualified(Name),
-    builtin_type_name(_, Name).
+    builtin_type_to_string(_, Name).

  is_builtin_type_name(Name) :-
-    builtin_type_name(_, Name).
-
-:- pred builtin_type_name(builtin_type, string).
-:- mode builtin_type_name(in, out) is det.
-:- mode builtin_type_name(out, in) is semidet.
+    builtin_type_to_string(_, Name).

-builtin_type_name(builtin_type_int, "int").
-builtin_type_name(builtin_type_uint, "uint").
-builtin_type_name(builtin_type_float, "float").
-builtin_type_name(builtin_type_string, "string").
-builtin_type_name(builtin_type_char, "character").
+builtin_type_to_string(builtin_type_int, "int").
+builtin_type_to_string(builtin_type_uint, "uint").
+builtin_type_to_string(builtin_type_float, "float").
+builtin_type_to_string(builtin_type_string, "string").
+builtin_type_to_string(builtin_type_char, "character").

  tvarset_merge_renaming(TVarSetA, TVarSetB, TVarSet, Renaming) :-
      varset.merge_renaming(TVarSetA, TVarSetB, TVarSet, Renaming).
diff --git a/compiler/prog_event.m b/compiler/prog_event.m
index 2558e63..ecc0044 100644
--- a/compiler/prog_event.m
+++ b/compiler/prog_event.m
@@ -64,7 +64,6 @@
  :- import_module mdbcomp.sym_name.
  :- import_module parse_tree.builtin_lib_types.
  :- import_module parse_tree.prog_mode.
-:- import_module parse_tree.prog_out.
  :- import_module parse_tree.prog_type.

  :- import_module assoc_list.
diff --git a/compiler/prog_out.m b/compiler/prog_out.m
index df3b971..5f7abe0 100644
--- a/compiler/prog_out.m
+++ b/compiler/prog_out.m
@@ -103,10 +103,6 @@

  :- func type_name_to_string(type_ctor) = string.

-:- pred builtin_type_to_string(builtin_type, string).
-:- mode builtin_type_to_string(in, out) is det.
-:- mode builtin_type_to_string(out, in) is semidet.
-
      % Print "predicate" or "function" depending on the given value.
      %
  :- pred write_pred_or_func(pred_or_func::in, io::di, io::uo) is det.
@@ -432,12 +428,6 @@ write_type_name(type_ctor(Name, _Arity), !IO) :-
  type_name_to_string(type_ctor(Name, _Arity)) =
      sym_name_to_escaped_string(Name).

-builtin_type_to_string(builtin_type_int, "int").
-builtin_type_to_string(builtin_type_uint, "uint").
-builtin_type_to_string(builtin_type_float, "float").
-builtin_type_to_string(builtin_type_string, "string").
-builtin_type_to_string(builtin_type_char, "character").
-
  write_promise_type(PromiseType, !IO) :-
      io.write_string(promise_to_string(PromiseType), !IO).



More information about the reviews mailing list