File tree Expand file tree Collapse file tree 2 files changed +12
-18
lines changed Expand file tree Collapse file tree 2 files changed +12
-18
lines changed Original file line number Diff line number Diff line change @@ -77,12 +77,14 @@ let add_async_attribute ~async (body : Parsetree.expression) =
7777let is_async : Parsetree.attribute -> bool =
7878 fun ({txt} , _ ) -> txt = " async" || txt = " res.async"
7979
80- let async_component expr =
81- let open Ast_helper in
82- Exp. apply
83- (Exp. ident
84- {
85- loc = Location. none;
86- txt = Ldot (Lident " JsxPPXReactSupport" , " asyncComponent" );
87- })
88- [(Nolabel , expr)]
80+ let async_component ~async expr =
81+ if async then
82+ let open Ast_helper in
83+ Exp. apply
84+ (Exp. ident
85+ {
86+ loc = Location. none;
87+ txt = Ldot (Lident " JsxPPXReactSupport" , " asyncComponent" );
88+ })
89+ [(Nolabel , expr)]
90+ else expr
Original file line number Diff line number Diff line change @@ -970,15 +970,7 @@ let mapBinding ~config ~emptyLoc ~pstr_loc ~fileName ~recFlag binding =
970970 else fullExpression
971971 in
972972 let fullExpression =
973- if isAsync then
974- Exp. apply
975- (Exp. ident
976- {
977- loc = Location. none;
978- txt = Ldot (Lident " JsxPPXReactSupport" , " asyncComponent" );
979- })
980- [(Nolabel , fullExpression)]
981- else fullExpression
973+ React_jsx_common. async_component ~async: isAsync fullExpression
982974 in
983975 let fullExpression =
984976 match fullModuleName with
You can’t perform that action at this time.
0 commit comments