diff options
author | Chimrod <> | 2025-07-19 11:18:24 +0200 |
---|---|---|
committer | Chimrod <> | 2025-08-01 14:12:14 +0200 |
commit | 3046fb0d0c1ceac2c6a6ca9456e9e05671e0cef9 (patch) | |
tree | 8ba2700e541a6753499ceac54ced4f1d02a3b625 /lib/checks/write_only.ml | |
parent | 406b7b79cd375b071f92ddee9cee14a98dc91281 (diff) |
Diffstat (limited to 'lib/checks/write_only.ml')
-rw-r--r-- | lib/checks/write_only.ml | 33 |
1 files changed, 24 insertions, 9 deletions
diff --git a/lib/checks/write_only.ml b/lib/checks/write_only.ml index e2c3d7e..2d78b59 100644 --- a/lib/checks/write_only.ml +++ b/lib/checks/write_only.ml @@ -15,6 +15,9 @@ let description = "Check variables never read" let active = ref false let is_global = true +let depends = [] + +type ex = Qsp_syntax.Identifier.t module StringMap = Hashtbl.Make (String) module Set = Set.Make (String) @@ -76,13 +79,16 @@ module Expression = struct let default _ map = ignore map end) - let ident : (S.pos, t) S.variable -> t = - fun variable filename map -> + let ident : ctx:Qsp_syntax.S.extract_context -> (S.pos, t) S.variable -> t = + fun ~ctx variable filename map -> + ignore ctx; (* Update the map and set the read flag *) set_readed variable.pos variable.name filename map - let literal : S.pos -> t T.literal list -> t = - fun pos l filename map -> + let literal : + ctx:Qsp_syntax.S.extract_context -> S.pos -> t T.literal list -> t = + fun ~ctx pos l filename map -> + ignore ctx; List.iter l ~f:(function | T.Text t -> set_readed pos ~update_only:true (String.uppercase_ascii t) filename @@ -91,13 +97,22 @@ module Expression = struct (* When the string contains an expression evaluate it *) exprs filename map) - let function_ : S.pos -> T.function_ -> t list -> t = - fun _ _ exprs filename map -> List.iter ~f:(fun v -> v filename map) exprs + let function_ : + ctx:Qsp_syntax.S.extract_context -> S.pos -> T.function_ -> t list -> t = + fun ~ctx _ _ exprs filename map -> + ignore ctx; + List.iter ~f:(fun v -> v filename map) exprs - let uoperator : S.pos -> T.uoperator -> t -> t = fun _ _ t map -> t map + let uoperator : + ctx:Qsp_syntax.S.extract_context -> S.pos -> T.uoperator -> t -> t = + fun ~ctx _ _ t map -> + ignore ctx; + t map - let boperator : S.pos -> T.boperator -> t -> t -> t = - fun _ _ t1 t2 filename map -> + let boperator : + ctx:Qsp_syntax.S.extract_context -> S.pos -> T.boperator -> t -> t -> t = + fun ~ctx _ _ t1 t2 filename map -> + ignore ctx; t1 filename map; t2 filename map end |