Selaa lähdekoodia

[python] if `main` expression is a block, simply output its expressions instead of trying to print it as a value

Dan Korostelev 9 vuotta sitten
vanhempi
commit
f57d4af468
1 muutettua tiedostoa jossa 5 lisäystä ja 1 poistoa
  1. 5 1
      src/generators/genpy.ml

+ 5 - 1
src/generators/genpy.ml

@@ -2428,7 +2428,11 @@ module Generator = struct
 			| Some e ->
 				newline ctx;
 				newline ctx;
-				gen_expr ctx e "" ""
+				match e.eexpr with
+				| TBlock el ->
+					List.iter (fun e -> gen_expr ctx e "" ""; newline ctx) el
+				| _ ->
+					gen_expr ctx e "" ""
 
 	(* Entry point *)