浏览代码

make sure switch case expressions are blockified as well (see #3317)

Simon Krajewski 11 年之前
父节点
当前提交
7344445ef6
共有 1 个文件被更改,包括 7 次插入0 次删除
  1. 7 0
      filters.ml

+ 7 - 0
filters.ml

@@ -28,6 +28,13 @@ let rec blockify_ast e =
 		{e with eexpr = TFunction {tf with tf_expr = mk_block (blockify_ast tf.tf_expr)}}
 	| TTry(e1,cl) ->
 		{e with eexpr = TTry(blockify_ast e1,List.map (fun (v,e) -> v,mk_block (blockify_ast e)) cl)}
+	| TSwitch(e1,cases,def) ->
+		let e1 = blockify_ast e1 in
+		let cases = List.map (fun (el,e) ->
+			el,mk_block (blockify_ast e)
+		) cases in
+		let def = match def with None -> None | Some e -> Some (blockify_ast e) in
+		{e with eexpr = TSwitch(e1,cases,def)}
 	| _ ->
 		Type.map_expr blockify_ast e