[m-rev.] diff: do not print the Mercury module declaration in generated Java

Julien Fischer jfischer at opturion.com
Fri Aug 2 13:42:41 AEST 2019


Do print the Mercury module declaration in generated Java.

compiler/mlds_to_java_file.m:
     Do not print a comment containing the Mercury module declaration at the
     head of the generated code unless the option --auto-comments is given.

Julien.

diff --git a/compiler/mlds_to_java_file.m b/compiler/mlds_to_java_file.m
index 88cbe50..a494866 100644
--- a/compiler/mlds_to_java_file.m
+++ b/compiler/mlds_to_java_file.m
@@ -567,10 +567,16 @@ output_env_var_definition_for_java(Indent, EnvVarName, !IO) :-
  output_src_start_for_java(Info, Indent, MercuryModuleName, Imports,
          ForeignDecls, FuncDefns, Errors, !IO) :-
      output_auto_gen_comment(Info ^ joi_source_filename, !IO),
-    output_n_indents(Indent, !IO),
-    io.write_string("/* :- module ", !IO),
-    prog_out.write_sym_name(MercuryModuleName, !IO),
-    io.write_string(". */\n\n", !IO),
+    AutoComments = Info ^ joi_auto_comments,
+    (
+        AutoComments = yes,
+        output_n_indents(Indent, !IO),
+        io.write_string("/* :- module ", !IO),
+        prog_out.write_sym_name(MercuryModuleName, !IO),
+        io.write_string(". */\n\n", !IO)
+    ;
+        AutoComments = no
+    ),
      output_n_indents(Indent, !IO),
      io.write_string("package jmercury;\n", !IO),



More information about the reviews mailing list