浏览代码

reduce parenthesizes at block toplevel

Nicolas Cannasse 14 年之前
父节点
当前提交
474a942753
共有 1 个文件被更改,包括 4 次插入0 次删除
  1. 4 0
      optimizer.ml

+ 4 - 0
optimizer.ml

@@ -440,6 +440,10 @@ let reduce_expr ctx e =
 		(match ec.eexpr with
 		| TBinop _ -> e (* TODO : we could remove this after we check all operators works well *)
 		| _ -> { ec with epos = e.epos })
+	| TBlock el ->
+		(* TODO : we could remove this after we check all operators works well *)
+		let no_parent e = match e.eexpr with TParenthesis ec -> { ec with epos = e.epos } | _ -> e in
+		{ e with eexpr = TBlock (List.map no_parent el) }
 	| _ ->
 		e