Browse Source

make sure to block-wrap singular expression if we have a void-inline (closes #4791)

Simon Krajewski 9 years ago
parent
commit
174ce103a9
1 changed files with 4 additions and 1 deletions
  1. 4 1
      optimizer.ml

+ 4 - 1
optimizer.ml

@@ -633,7 +633,10 @@ let rec type_inline ctx cf f ethis params tret config p ?(self_calling_closure=f
 		in
 		let e = (match e.eexpr, init with
 			| _, None when not !has_return_value ->
-				{e with etype = tret}
+				begin match e.eexpr with
+					| TBlock _ -> {e with etype = tret}
+					| _ -> mk (TBlock [e]) tret e.epos
+				end
 			| TBlock [e] , None -> wrap e
 			| _ , None -> wrap e
 			| TBlock l, Some vl ->