From: Alexandre Terrasa Date: Tue, 30 Jun 2015 19:08:56 +0000 (-0400) Subject: nitj: compile java main function stub X-Git-Tag: v0.7.7~17^2~14 X-Git-Url: http://nitlanguage.org nitj: compile java main function stub Signed-off-by: Alexandre Terrasa --- diff --git a/src/compiler/java_compiler.nit b/src/compiler/java_compiler.nit index 03fef84..dfdff67 100644 --- a/src/compiler/java_compiler.nit +++ b/src/compiler/java_compiler.nit @@ -217,8 +217,8 @@ class JavaCompiler # compile method structures compile_mmethods_to_java - # TODO compile main - modelbuilder.toolcontext.info("NOT YET IMPLEMENTED", 0) + # compile main + compile_main_function end # Prepare the boxes used to represent Java primitive types @@ -260,6 +260,17 @@ class JavaCompiler end end end + + # Generate Java main that call Sys.main + fun compile_main_function do + var v = new_visitor("{mainmodule.jname}_Main.java") + v.add("public class {mainmodule.jname}_Main \{") + v.add(" public static void main(String[] args) \{") + modelbuilder.toolcontext.info("NOT YET IMPLEMENTED", 0) + # TODO compile call to Sys::main + v.add(" \}") + v.add("\}") + end end # The class visiting the AST