Browse Source

reduce parenthesizes at block toplevel

Nicolas Cannasse 14 years ago
parent
commit
474a942753
1 changed files with 4 additions and 0 deletions
  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