File tree Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -45,17 +45,23 @@ let simplify_alias (meta : Lam_stats.t) (lam : Lam.t) : Lam.t =
45
45
let rec simpl (lam : Lam.t ) : Lam.t =
46
46
match lam with
47
47
| Lvar _ -> lam
48
+ (* 7432: prevent optimization in JSX preserve mode *)
49
+ | Lprim
50
+ {
51
+ primitive = Pjs_call {prim_name = " jsx" | " jsxs" } as primitive;
52
+ args = (Lprim {primitive = Pfield (_, _)} as field_arg) :: rest;
53
+ loc;
54
+ }
55
+ when ! Js_config. jsx_preserve ->
56
+ Lam. prim ~primitive ~args: (field_arg :: Ext_list. map rest simpl) loc
48
57
| Lprim {primitive = Pfield (i , info ) as primitive ; args = [arg]; loc} -> (
49
58
(* ATTENTION:
50
59
Main use case, we should detect inline all immutable block .. *)
51
60
match simpl arg with
52
61
| Lvar v as l ->
53
- (* Preserve module qualification when JSX preserve mode is enabled
54
- This ensures component names like X.make are not flattened to just make
55
- in JSX preserve mode *)
56
- let prim = Lam. prim ~primitive ~args: [l] loc in
57
- if ! Js_config. jsx_preserve then prim
58
- else Lam_util. field_flatten_get (fun _ -> prim) v i info meta.ident_tbl
62
+ Lam_util. field_flatten_get
63
+ (fun _ -> Lam. prim ~primitive ~args: [l] loc)
64
+ v i info meta.ident_tbl
59
65
| l -> Lam. prim ~primitive ~args: [l] loc)
60
66
| Lprim
61
67
{
You can’t perform that action at this time.
0 commit comments