aboutsummaryrefslogtreecommitdiff
path: root/lib/syntax/tree.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/tree.ml
parent736456d9952c1d58008f4ca5755913dfff7a32b8 (diff)
Used the dead-end checker in main analysis
Diffstat (limited to 'lib/syntax/tree.ml')
-rw-r--r--lib/syntax/tree.ml9
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)