[erl-frontend] Adjust translation of expression Case

Summary:
There should be no change in semantics:
  - before: the "crash node" modelling throwing an exception was connected directly to the exit of the procedure
  - now: the "crash node" goes to exit_failure, which should end up being connected to the exit of the procedure by the `translate_one_function`

The latter is closer to what we'd need to do when we eventually model
throwing and catching exceptions (rather than just reporting an error
the moment we see them thrown).

Differential Revision: D29540834

fbshipit-source-id: c4de4c391
master
Radu Grigore 3 years ago committed by Facebook GitHub Bot
parent 6788fdef7e
commit 3ba916530a

@ -393,10 +393,9 @@ let rec translate_expression env {Ast.line; simple_expression} =
let expr_block = translate_expression {env with result= Present (Exp.Var id)} expression in
let blocks = Block.any env (List.map ~f:(translate_case_clause env [id]) cases) in
let crash_node = Node.make_pattern_fail env in
let {Block.start; exit_success; exit_failure} = Block.all env [expr_block; blocks] in
blocks.exit_failure |~~> [crash_node] ;
crash_node |~~> [Procdesc.get_exit_node procdesc] ;
{start; exit_success; exit_failure}
let blocks = {blocks with exit_failure= crash_node} in
Block.all env [expr_block; blocks]
| Cons {head; tail} ->
let head_var = Ident.create_fresh Ident.knormal in
let tail_var = Ident.create_fresh Ident.knormal in

Loading…
Cancel
Save