Browse Source

fixed "try" syntax when no curly braces.

Nicolas Cannasse 19 years ago
parent
commit
65564b6a38
1 changed files with 3 additions and 1 deletions
  1. 3 1
      genjs.ml

+ 3 - 1
genjs.ml

@@ -303,7 +303,9 @@ and gen_expr ctx e =
 		handle_break();
 	| TTry (e,catchs) ->
 		spr ctx "try ";
-		gen_expr ctx e;
+		(match e.eexpr with
+		| TBlock _ -> gen_expr ctx e
+		| _ -> gen_expr ctx (mk (TBlock [e]) e.etype e.epos));
 		newline ctx;
 		let id = ctx.id_counter in
 		ctx.id_counter <- ctx.id_counter + 1;