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/tree.ml | |
parent | 736456d9952c1d58008f4ca5755913dfff7a32b8 (diff) |
Used the dead-end checker in main analysis
Diffstat (limited to 'lib/syntax/tree.ml')
-rw-r--r-- | lib/syntax/tree.ml | 9 |
1 files changed, 7 insertions, 2 deletions
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) |