From 0b75cd5bc0f7d0ad905bce5bebc6e47c927f64d7 Mon Sep 17 00:00:00 2001 From: Chimrod <> Date: Mon, 16 Oct 2023 16:42:53 +0200 Subject: Used the dead-end checker in main analysis --- lib/syntax/tree.ml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'lib/syntax/tree.ml') diff --git a/lib/syntax/tree.ml b/lib/syntax/tree.ml index fb6135f..85e130d 100644 --- a/lib/syntax/tree.ml +++ b/lib/syntax/tree.ml @@ -93,7 +93,7 @@ module Instruction : 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 predicate ~elifs ~else_ report -> let clause (pos, expr, repr) = @@ -101,7 +101,12 @@ module Instruction : (pos, fst @@ expr [], repr) in let elifs = List.map ~f:clause elifs - and else_ = List.map ~f:(fun instr -> fst @@ instr []) else_ in + and else_ = + match else_ with + | None -> [] + | Some (_, instructions) -> + List.map ~f:(fun instr -> fst @@ instr []) instructions + in (Ast.If { loc = pos; then_ = clause predicate; elifs; else_ }, report) -- cgit v1.2.3