Skip to content

Commit

Permalink
Desugar suspends used in 'expression statements' in the generated sta…
Browse files Browse the repository at this point in the history
…te machine

Summary: Expression statements now permit suspensions.

Reviewed By: ericlippert

Differential Revision: D5021257

fbshipit-source-id: 2fa98a57c921c8416b46c851180ab9593c2702f9
  • Loading branch information
michaeltingley authored and hhvm-bot committed May 9, 2017
1 parent 71f4b2a commit 2a45f66
Showing 1 changed file with 12 additions and 1 deletion.
Expand Up @@ -325,8 +325,19 @@ let rewrite_suspends node =
let new_do =
make_syntax (DoStatement { node with do_condition; do_body; }) in
next_label, Rewriter.Result.Replace new_do
| ExpressionStatement ({ expression_statement_expression; _; } as node) ->
let (next_label, prefix_statements), expression_statement_expression =
extract_suspend_statements
expression_statement_expression
next_label in
let new_expression_statement =
make_syntax
(ExpressionStatement
{ node with expression_statement_expression; }) in
let statements = prefix_statements @ [ new_expression_statement ] in
let statements = make_compound_statement_syntax statements in
next_label, Rewriter.Result.Replace statements
| WhileStatement _ (* TODO(t17335630): Support suspends here. *)
| ExpressionStatement _ (* TODO(t17335630): Support suspends here. *)
| UnsetStatement _ (* TODO(t17335630): Support suspends here. *)
| ForStatement _ (* TODO(t17335630): Support suspends here. *)
| ForeachStatement _ (* TODO(t17335630): Support suspends here. *)
Expand Down

0 comments on commit 2a45f66

Please sign in to comment.