@@ -117,12 +117,14 @@ and assertion_of_json (ctx : of_json_ctx) (js : json) :
117117 combine_error_msgs js __FUNCTION__
118118 (match js with
119119 | `Assoc
120- [ (" cond" , cond); (" expected" , expected); (" on_failure " , on_failure ) ]
120+ [ (" cond" , cond); (" expected" , expected); (" check_kind " , check_kind ) ]
121121 ->
122122 let * cond = operand_of_json ctx cond in
123123 let * expected = bool_of_json ctx expected in
124- let * on_failure = abort_kind_of_json ctx on_failure in
125- Ok ({ cond; expected; on_failure } : assertion )
124+ let * check_kind =
125+ option_of_json builtin_assert_kind_of_json ctx check_kind
126+ in
127+ Ok ({ cond; expected; check_kind } : assertion )
126128 | _ -> Error " " )
127129
128130and attr_info_of_json (ctx : of_json_ctx ) (js : json ) :
@@ -250,6 +252,44 @@ and borrow_kind_of_json (ctx : of_json_ctx) (js : json) :
250252 | `String "UniqueImmutable" -> Ok BUniqueImmutable
251253 | _ -> Error " " )
252254
255+ and builtin_assert_kind_of_json (ctx : of_json_ctx ) (js : json ) :
256+ (builtin_assert_kind , string ) result =
257+ combine_error_msgs js __FUNCTION__
258+ (match js with
259+ | `Assoc [ (" BoundsCheck" , `Assoc [ (" len" , len); (" index" , index) ]) ] ->
260+ let * len = operand_of_json ctx len in
261+ let * index = operand_of_json ctx index in
262+ Ok (BoundsCheck (len, index))
263+ | `Assoc [ (" Overflow" , `List [ x_0; x_1; x_2 ]) ] ->
264+ let * x_0 = binop_of_json ctx x_0 in
265+ let * x_1 = operand_of_json ctx x_1 in
266+ let * x_2 = operand_of_json ctx x_2 in
267+ Ok (Overflow (x_0, x_1, x_2))
268+ | `Assoc [ (" OverflowNeg" , overflow_neg) ] ->
269+ let * overflow_neg = operand_of_json ctx overflow_neg in
270+ Ok (OverflowNeg overflow_neg)
271+ | `Assoc [ (" DivisionByZero" , division_by_zero) ] ->
272+ let * division_by_zero = operand_of_json ctx division_by_zero in
273+ Ok (DivisionByZero division_by_zero)
274+ | `Assoc [ (" RemainderByZero" , remainder_by_zero) ] ->
275+ let * remainder_by_zero = operand_of_json ctx remainder_by_zero in
276+ Ok (RemainderByZero remainder_by_zero)
277+ | `Assoc
278+ [
279+ ( " MisalignedPointerDereference" ,
280+ `Assoc [ (" required" , required); (" found" , found) ] );
281+ ] ->
282+ let * required = operand_of_json ctx required in
283+ let * found = operand_of_json ctx found in
284+ Ok (MisalignedPointerDereference (required, found))
285+ | `String "NullPointerDereference" -> Ok NullPointerDereference
286+ | `Assoc [ (" InvalidEnumConstruction" , invalid_enum_construction) ] ->
287+ let * invalid_enum_construction =
288+ operand_of_json ctx invalid_enum_construction
289+ in
290+ Ok (InvalidEnumConstruction invalid_enum_construction)
291+ | _ -> Error " " )
292+
253293and builtin_fun_id_of_json (ctx : of_json_ctx ) (js : json ) :
254294 (builtin_fun_id , string ) result =
255295 combine_error_msgs js __FUNCTION__
0 commit comments