Skip to content

Commit

Permalink
Default location.byte to -1 if missing in JSON
Browse files Browse the repository at this point in the history
  • Loading branch information
karoliineh committed Aug 22, 2024
1 parent 0d6d3a8 commit 3c54188
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/common/util/cilType.ml
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ struct

let of_yojson = function
| `Assoc l ->
begin match List.assoc_opt "file" l, List.assoc_opt "line" l, List.assoc_opt "column" l, List.assoc_opt "byte" l with
| Some (`String file), Some (`Int line), Some (`Int column), Some (`Int byte) ->
begin match List.assoc_opt "file" l, List.assoc_opt "line" l, List.assoc_opt "column" l, Option.value ~default:(`Int (-1)) (List.assoc_opt "byte" l) with
| Some (`String file), Some (`Int line), Some (`Int column), `Int byte ->
let loc = {file; line; column; byte; endLine = -1; endColumn = -1; endByte = -1; synthetic = false} in
begin match List.assoc_opt "endLine" l, List.assoc_opt "endColumn" l, List.assoc_opt "endByte" l with
| Some (`Int endLine), Some (`Int endColumn), Some (`Int endByte) ->
Expand Down

0 comments on commit 3c54188

Please sign in to comment.