File tree Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -264,13 +264,29 @@ let expr_mapper ~async_context ~in_function_def (self : mapper)
264
264
let async_saved = ! async_context in
265
265
let result = expr_mapper ~async_context ~in_function_def self e in
266
266
async_context := async_saved;
267
- match Ast_attributes. has_await_payload e.pexp_attributes with
267
+ let is_module, has_await =
268
+ match e.pexp_desc with
269
+ | Pexp_letmodule (_, {pmod_desc = Pmod_ident _; pmod_attributes}, _)
270
+ | Pexp_letmodule
271
+ ( _,
272
+ {
273
+ pmod_desc =
274
+ Pmod_constraint
275
+ ({pmod_desc = Pmod_ident _}, {pmty_desc = Pmty_ident _});
276
+ pmod_attributes;
277
+ },
278
+ _ ) ->
279
+ (true , Ast_attributes. has_await_payload pmod_attributes)
280
+ | _ -> (false , Ast_attributes. has_await_payload e.pexp_attributes)
281
+ in
282
+ match has_await with
268
283
| None -> result
269
284
| Some _ ->
270
285
if ! async_context = false then
271
286
Location. raise_errorf ~loc: e.pexp_loc
272
287
" Await on expression not in an async context" ;
273
- Ast_await. create_await_expression result
288
+ if is_module = false then Ast_await. create_await_expression result
289
+ else result
274
290
275
291
let typ_mapper (self : mapper ) (typ : Parsetree.core_type ) =
276
292
Ast_core_type_class_type. typ_mapper self typ
You can’t perform that action at this time.
0 commit comments