فهرست منبع

don't use int switch for empty cases

Nicolas Cannasse 16 سال پیش
والد
کامیت
04e78540dc
1فایلهای تغییر یافته به همراه3 افزوده شده و 0 حذف شده
  1. 3 0
      gencpp.ml

+ 3 - 0
gencpp.ml

@@ -609,6 +609,9 @@ let list_num l = string_of_int (List.length l);;
 
 
 let only_int_cases cases =
+	match cases with
+	| [] -> false
+	| _ ->
 	not (List.exists (fun (cases,expression) -> 
 			List.exists (fun case -> match case.eexpr with TConst (TInt _) -> false | _ -> true ) cases
 				) cases );;