Add an error (in java main) when the specified main node is incorrect.

Conflicts:

	compiler/obc/java/java_main.ml
This commit is contained in:
Léonard Gérard 2011-07-05 14:35:23 +02:00
parent 1c428e7fe1
commit 4ac4347dc8

View file

@ -1,5 +1,6 @@
open Misc
open Names
open Modules
open Signature
open Java
open Java_printer
@ -22,6 +23,13 @@ let program p =
(* Create a runnable main simulation *)
if !Compiler_options.simulation
then (
let q_main =
try !Compiler_options.simulation_node |> qualify_value
with Not_found ->
Format.eprintf "Unable to find main node: %s@." !Compiler_options.simulation_node;
raise Errors.Error
in
let ty_main = (find_value q_main).node_outputs |> types_of_arg_list |> Types.prod in
let class_name = Obc2java.fresh_classe (!Compiler_options.simulation_node ^ "_sim") in
Idents.enter_node class_name;
let field_step_dnb, id_step_dnb =
@ -34,9 +42,6 @@ let program p =
mk_var (Tarray (Tclass (Names.pervasives_qn "String"), (Sint 0))) "args" in
let body =
let vd_main, e_main, q_main, ty_main =
let q_main = !Compiler_options.simulation_node |> Modules.qualify_value in (*qual*)
let ty_main =
(Modules.find_value q_main).node_outputs |> types_of_arg_list |> Types.prod in
let q_main = Obc2java.qualname_to_package_classe q_main in (*java qual*)
let id = Idents.gen_var "java_main" "main" in
mk_var_dec id (Tclass q_main), Evar id, q_main, ty_main