aboutsummaryrefslogtreecommitdiff
path: root/lib/syntax/check.ml
diff options
context:
space:
mode:
authorChimrod <>2023-10-16 16:42:53 +0200
committerChimrod <>2023-10-18 11:19:35 +0200
commit0b75cd5bc0f7d0ad905bce5bebc6e47c927f64d7 (patch)
tree9381b4b3b6c06104d773978f330f073b805a40f0 /lib/syntax/check.ml
parent736456d9952c1d58008f4ca5755913dfff7a32b8 (diff)
Used the dead-end checker in main analysis
Diffstat (limited to 'lib/syntax/check.ml')
-rw-r--r--lib/syntax/check.ml20
1 files changed, 15 insertions, 5 deletions
diff --git a/lib/syntax/check.ml b/lib/syntax/check.ml
index 3e9d255..3e01e64 100644
--- a/lib/syntax/check.ml
+++ b/lib/syntax/check.ml
@@ -464,13 +464,19 @@ module Make (A : App) = struct
S.pos ->
(expression, t) S.clause ->
elifs:(expression, t) S.clause list ->
- else_:t S.repr list ->
+ else_:(S.pos * t S.repr list) option ->
t S.repr =
fun pos clause ~elifs ~else_ report ->
(* First, apply the report for all the instructions *)
let report, clause = map_clause report clause in
let report, elifs = List.fold_left_map elifs ~init:report ~f:map_clause in
- let report, else_ = Helper.map_args report else_ in
+ let report, else_ =
+ match else_ with
+ | None -> (report, None)
+ | Some (pos, instructions) ->
+ let report, instructions = Helper.map_args report instructions in
+ (report, Some (pos, instructions))
+ in
let report = ref report and len = Array.length A.t in
let result =
@@ -485,9 +491,13 @@ module Make (A : App) = struct
let clause = rebuild_clause i instr_witness expr_witness f clause
and elifs =
List.map elifs ~f:(rebuild_clause i instr_witness expr_witness f)
- and elses = Helper.args_i else_ instr_witness i in
-
- let else_ = List.rev elses.values in
+ and else_ =
+ match else_ with
+ | None -> None
+ | Some (pos, instructions) ->
+ let elses = Helper.args_i instructions instr_witness i in
+ Some (pos, List.rev elses.values)
+ in
let value, r = A.Instruction.if_ pos clause ~elifs ~else_ !report in
report := r;