Explorar o código

don't use int switch for empty cases

Nicolas Cannasse %!s(int64=16) %!d(string=hai) anos
pai
achega
04e78540dc
Modificáronse 1 ficheiros con 3 adicións e 0 borrados
  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 );;