瀏覽代碼

[js] do not remove parens from nested ternaries

Simon Krajewski 11 年之前
父節點
當前提交
a5f0f8e94e
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      genjs.ml

+ 1 - 1
genjs.ml

@@ -858,7 +858,7 @@ and gen_value ctx e =
 	| TIf (cond,e,eo) ->
 		(* remove parenthesis unless it's an operation with higher precedence than ?: *)
 		let cond = (match cond.eexpr with
-			| TParenthesis { eexpr = TBinop ((Ast.OpAssign | Ast.OpAssignOp _),_,_) } -> cond
+			| TParenthesis { eexpr = TBinop ((Ast.OpAssign | Ast.OpAssignOp _),_,_) | TIf _ } -> cond
 			| TParenthesis e -> e
 			| _ -> cond
 		) in