Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default the value of CilType.Location.Byte to -1 if missing in JSON #1563

Merged
merged 1 commit into from
Aug 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading