Skip to content

Commit 96e8ecb

Browse files
authored
fix(compiler): Iterate over guard clauses in typedTreeIter/typedTreeMap (#1283)
1 parent d3e7a33 commit 96e8ecb

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

compiler/src/typed/typedtreeIter.re

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,10 @@ module MakeIterator =
8989
Iter.leave_bindings(rec_flag, mut_flag);
9090
}
9191

92-
and iter_match_branch = ({mb_pat, mb_body}) => {
92+
and iter_match_branch = ({mb_pat, mb_body, mb_guard}) => {
9393
iter_pattern(mb_pat);
9494
iter_expression(mb_body);
95+
Option.iter(iter_expression, mb_guard);
9596
}
9697

9798
and iter_match_branches = branches => List.iter(iter_match_branch, branches)

compiler/src/typed/typedtreeMap.re

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,11 @@ module MakeMap =
8282
and map_bindings = (rec_flag, mut_flag, binds) =>
8383
List.map(map_binding, binds)
8484

85-
and map_match_branch = ({mb_pat, mb_body} as mb) => {
85+
and map_match_branch = ({mb_pat, mb_body, mb_guard} as mb) => {
8686
let mb_pat = map_pattern(mb_pat);
8787
let mb_body = map_expression(mb_body);
88-
{...mb, mb_pat, mb_body};
88+
let mb_guard = Option.map(map_expression, mb_guard);
89+
{...mb, mb_pat, mb_body, mb_guard};
8990
}
9091

9192
and map_match_branches = branches => List.map(map_match_branch, branches)

0 commit comments

Comments
 (0)