@@ -1475,18 +1475,15 @@ and make_if_then_else ctx e0 e1 e2 with_type p =
14751475 mk (TIf (e0,e1,Some e2)) t p
14761476
14771477and warn_assign_in_condition ctx cond =
1478- let rec skip_without_parentheses e = match e.eexpr with
1479- | TMeta (_ ,e1 ) | TBlock [e1] | TCast (e1 ,None) -> skip e1
1480- | _ -> e in
14811478 let rec is_assign e =
1482- let e = skip_without_parentheses e in
1479+ let e = Texpr. skip e in
14831480 match e.eexpr with
14841481 | TBinop (OpAssign, _ , rhs ) ->
14851482 let t = follow rhs.etype in
14861483 let is_bool = ExtType. is_bool t in
1487- let is_null = match (skip_without_parentheses rhs).eexpr with | TConst TNull -> true | _ -> false in
1484+ let is_null = match (Texpr. skip rhs).eexpr with | TConst TNull -> true | _ -> false in
14881485 if is_bool || is_null then
1489- warning ctx WConditionAssign " Using the result of an assignment as a condition without parentheses " e.epos
1486+ warning ctx WConditionAssign " Using the result of an assignment as a condition" e.epos
14901487 | TBinop ((OpBoolAnd | OpBoolOr ), e1 , e2 ) ->
14911488 is_assign e1;
14921489 is_assign e2;
@@ -1504,7 +1501,6 @@ and type_if ctx e e1 e2 with_type is_ternary p =
15041501 let e = type_expr ctx e WithType. value in
15051502 if is_ternary then begin match e.eexpr with
15061503 | TConst TNull -> raise_typing_error " Cannot use null as ternary condition" e.epos
1507- | TParenthesis e -> warn_assign_in_condition ctx e;
15081504 | _ -> ()
15091505 end ;
15101506 warn_assign_in_condition ctx e;
0 commit comments