aboutsummaryrefslogtreecommitdiff
path: root/lib/syntax/tree.ml
diff options
context:
space:
mode:
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)