patch java wrong merge.

This commit is contained in:
Léonard Gérard 2011-07-08 15:25:00 +02:00
parent 40e64b305d
commit 13955147ca
3 changed files with 7 additions and 1 deletions

View file

@ -21,6 +21,7 @@ type ty = Tclass of class_name
| Tgeneric of class_name * ty list
| Tbool
| Tint
| Tlong
| Tfloat
| Tarray of ty * exp list
| Tunit
@ -107,6 +108,7 @@ let rec default_value ty = match ty with
| Tgeneric _ -> Snull
| Tbool -> Sbool true
| Tint -> Sint 0
| Tlong -> Sint 0
| Tfloat -> Sfloat 0.0
| Tunit -> Evoid
| Tarray _ -> Enew_array (ty,[])

View file

@ -47,7 +47,7 @@ let program p =
let vd_args, _, exp_args =
mk_var (Tarray (Tclass (Names.pervasives_qn "String"), [Sint 0])) "args" in
let get_arg i = Earray_elem(exp_args, Sint i) in
let get_arg i = Earray_elem(exp_args, [Sint i]) in
(* (* argnb is the current argument during the parsing *)
let vd_argnb, pat_argnb, exp_argnb = mk_var Tint "argNb" in
@ -67,6 +67,8 @@ let program p =
let jint = Eclass(Names.qualname_of_string "Integer") in
let jfloat = Eclass(Names.qualname_of_string "Float") in
let jbool = Eclass(Names.qualname_of_string "Boolean") in
let jsys = Eclass(Names.qualname_of_string "java.lang.System") in
let jminus = pervasives_qn "-" in
(* parse arguments to give to the main *)
let rec parse_args t_l i = match t_l with
@ -102,6 +104,7 @@ let program p =
| t when t = Initial.tfloat -> Emethod_call(jfloat, "toString", [ret])
| t when t = Initial.tbool -> Emethod_call(jbool, "toString", [ret])
| _ -> Emethod_call(ret, "toString", [])
in
let main_for_loop i =
[Aexp (Emethod_call(out, "printf",
[Sstring "%d => %s\\n"; Evar i; print_ret]))]

View file

@ -38,6 +38,7 @@ let final ff f = if f then fprintf ff "final " else ()
let rec _ty news ff t = match t with
| Tbool -> fprintf ff "boolean"
| Tint -> fprintf ff "int"
| Tlong -> fprintf ff "long"
| Tfloat -> fprintf ff "float"
| Tclass n -> class_name ff n
| Tgeneric (n, ty_l) ->