diff options
author | Chimrod <> | 2023-10-16 16:42:53 +0200 |
---|---|---|
committer | Chimrod <> | 2023-10-18 11:19:35 +0200 |
commit | 0b75cd5bc0f7d0ad905bce5bebc6e47c927f64d7 (patch) | |
tree | 9381b4b3b6c06104d773978f330f073b805a40f0 /lib/syntax/check.ml | |
parent | 736456d9952c1d58008f4ca5755913dfff7a32b8 (diff) |
Used the dead-end checker in main analysis
Diffstat (limited to 'lib/syntax/check.ml')
-rw-r--r-- | lib/syntax/check.ml | 20 |
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; |