Skip to content

Commit

Permalink
Merge pull request #1563 from goblint/location_of_yojson
Browse files Browse the repository at this point in the history
Default the value of `CilType.Location.Byte` to -1 if missing in JSON
  • Loading branch information
sim642 authored Aug 26, 2024
2 parents 0d6d3a8 + 3c54188 commit f27ae52
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 f27ae52

Please sign in to comment.