aboutsummaryrefslogtreecommitdiff
path: root/lib/syntax/dead_end.ml
diff options
context:
space:
mode:
Diffstat (limited to 'lib/syntax/dead_end.ml')
-rw-r--r--lib/syntax/dead_end.ml18
1 files changed, 10 insertions, 8 deletions
diff --git a/lib/syntax/dead_end.ml b/lib/syntax/dead_end.ml
index 36c997f..d1683cd 100644
--- a/lib/syntax/dead_end.ml
+++ b/lib/syntax/dead_end.ml
@@ -10,21 +10,22 @@ module Expression = struct
let default = ()
end)
- let v : t * Report.t list -> t' * Report.t list = Fun.id
+ let v : t -> t' * Report.t list = fun () -> ((), [])
end
module Instruction = struct
- type expression = Expression.t' S.repr
+ type expression = Expression.t' * Report.t list
type cause = Missing_else | Unchecked_path
- type t = {
+ type state = {
block_pos : S.pos;
has_gt : bool;
is_gt : bool;
pos : (cause * S.pos) option;
}
- type t' = t
+ type t = state * Report.t list
+ type t' = state
(** For each instruction, return thoses two informations :
@@ -32,7 +33,7 @@ module Instruction = struct
- the last instruction is a [gt]
*)
- let v : t * Report.t list -> t' * Report.t list = Fun.id
+ let v : t -> t' * Report.t list = fun t -> t
let default =
{
@@ -144,14 +145,15 @@ end
module Location = struct
type t = unit
- type instruction = Instruction.t
+ type instruction = (Instruction.t' * Report.t list) S.repr
- let location : S.pos -> instruction S.repr list -> t S.repr =
+ let location : S.pos -> instruction list -> (t * Report.t list) S.repr =
fun _pos instructions report ->
( (),
List.fold_left instructions ~init:report ~f:(fun report instruction ->
- let t, report = instruction report in
+ let t, r = instruction [] in
+ let report = List.rev_append r report in
match (t.Instruction.is_gt, t.Instruction.pos) with
| false, Some (cause, value) ->
ignore cause;