Explorar o código

fixed "try" syntax when no curly braces.

Nicolas Cannasse %!s(int64=19) %!d(string=hai) anos
pai
achega
65564b6a38
Modificáronse 1 ficheiros con 3 adicións e 1 borrados
  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;