소스 검색

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