Skip to content

Commit

Permalink
erl_syntax_lib annotate else_expr correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkoMin committed Sep 13, 2024
1 parent 898343c commit d97f353
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/syntax_tools/src/erl_syntax_lib.erl
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,8 @@ vann(Tree, Env) ->
vann_maybe_match_expr(Tree, Env);
case_expr ->
vann_case_expr(Tree, Env);
else_expr ->
vann_else_expr(Tree, Env);
if_expr ->
vann_if_expr(Tree, Env);
receive_expr ->
Expand Down Expand Up @@ -578,6 +580,12 @@ vann_case_expr(Tree, Env) ->
Tree1 = rewrite(Tree, erl_syntax:case_expr(E1, Cs1)),
{ann_bindings(Tree1, Env, Bound, Free), Bound, Free}.

vann_else_expr(Tree, Env) ->
Cs = erl_syntax:else_expr_clauses(Tree),
{Cs1, {Bound, Free}} = vann_clauses(Cs, Env),
Tree1 = rewrite(Tree, erl_syntax:else_expr(Cs1)),
{ann_bindings(Tree1, Env, Bound, Free), Bound, Free}.

vann_if_expr(Tree, Env) ->
Cs = erl_syntax:if_expr_clauses(Tree),
{Cs1, {Bound, Free}} = vann_clauses(Cs, Env),
Expand Down

0 comments on commit d97f353

Please sign in to comment.