Nicolas Cannasse 16 vuotta sitten
vanhempi
commit
5d27b8b939
1 muutettua tiedostoa jossa 4 lisäystä ja 1 poistoa
  1. 4 1
      optimizer.ml

+ 4 - 1
optimizer.ml

@@ -386,7 +386,10 @@ let rec reduce_loop com is_sub e =
 			| OpNotEq -> { e with eexpr = TConst (TBool (f1 <> f2)) }
 			| _ -> e)
 		| _, TCall ({ eexpr = TEnumField _ },_) | TCall ({ eexpr = TEnumField _ },_), _ ->
-			error "You cannot directly compare enums with arguments. Use either 'switch' or 'Type.enumEq'" e.epos
+			(match op with
+			| OpAssign -> e
+			| _ -> 
+				error "You cannot directly compare enums with arguments. Use either 'switch' or 'Type.enumEq'" e.epos)			
 		| _ -> e)
 	| TUnop (op,flag,esub) ->
 		(match op, esub.eexpr with