2 * Copyright (c) 2016, Facebook, Inc.
5 * This source code is licensed under the BSD-style license found in the
6 * LICENSE file in the "hack" directory of this source tree. An additional grant
7 * of patent rights can be found in the PATENTS file in the same directory.
10 module CoroutineSyntax
= Coroutine_syntax
11 module EditableSyntax
= Full_fidelity_editable_syntax
16 let generate_coroutine_state_machine_body =
17 [ throw_unimplemented_syntax
"Coroutines are not yet implemented." ]
20 * If the provided methodish declaration is for a coroutine, rewrites the
21 * declaration header and the function body into a desugared coroutine
24 let generate_coroutine_state_machine
27 { methodish_function_decl_header
; _
; }
28 { function_type
; _
; } =
29 make_methodish_declaration_syntax
30 (make_function_decl_header_syntax
31 (make_state_machine_method_name function_name
)
33 make_closure_parameter_syntax classish_name function_name
;
34 coroutine_data_parameter_syntax
;
35 nullable_exception_parameter_syntax
;
37 (make_coroutine_result_type_syntax function_type
))
38 (generate_coroutine_state_machine_body)