Skip to content

Commit 0c38b28

Browse files
Fix syntax snapshots
1 parent 8591431 commit 0c38b28

22 files changed

Lines changed: 83 additions & 23 deletions

compiler/syntax/src/jsx_v4.ml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1331,6 +1331,17 @@ let mk_uppercase_tag_name_expr tag_name =
13311331

13321332
let expr ~(config : Jsx_common.jsx_config) mapper expression =
13331333
match expression with
1334+
| {pexp_desc = Pexp_letmodule (name, module_expr, body); pexp_loc = loc; pexp_attributes = attrs}
1335+
->
1336+
config.nested_modules <- name.txt :: config.nested_modules;
1337+
let mapped_module_expr = default_mapper.module_expr mapper module_expr in
1338+
let mapped_body = mapper.expr mapper body in
1339+
let () =
1340+
match config.nested_modules with
1341+
| _ :: rest -> config.nested_modules <- rest
1342+
| [] -> ()
1343+
in
1344+
Exp.letmodule ~loc ~attrs name mapped_module_expr mapped_body
13341345
| {
13351346
pexp_desc = Pexp_jsx_element jsx_element;
13361347
pexp_loc = loc;

tests/syntax_tests/data/ppx/react/expected/aliasProps.res.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,10 +148,17 @@ module C6 = {
148148
}
149149

150150
let make = ({comp: module(Comp: Comp), x: (a, b), _}: props<_, _>): React.element =>
151-
React.jsx(Comp.make, {})
151+
React.jsx(@res.jsxComponentPath Comp.make, {})
152152
let make = {
153153
let \"AliasProps$C6" = (props: props<_>) => make(props)
154154

155155
\"AliasProps$C6"
156156
}
157157
}
158+
let \"AliasProps$C0" = C0.make and \"AliasProps$C0$jsx" = true
159+
let \"AliasProps$C1" = C1.make and \"AliasProps$C1$jsx" = true
160+
let \"AliasProps$C2" = C2.make and \"AliasProps$C2$jsx" = true
161+
let \"AliasProps$C3" = C3.make and \"AliasProps$C3$jsx" = true
162+
let \"AliasProps$C4" = C4.make and \"AliasProps$C4$jsx" = true
163+
let \"AliasProps$C5" = C5.make and \"AliasProps$C5$jsx" = true
164+
let \"AliasProps$C6" = C6.make and \"AliasProps$C6$jsx" = true

tests/syntax_tests/data/ppx/react/expected/asyncAwait.res.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,5 @@ module C1 = {
3535
\"AsyncAwait$C1"
3636
}
3737
}
38+
let \"AsyncAwait$C0" = C0.make and \"AsyncAwait$C0$jsx" = true
39+
let \"AsyncAwait$C1" = C1.make and \"AsyncAwait$C1$jsx" = true

tests/syntax_tests/data/ppx/react/expected/defaultValueProp.res.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,3 +86,7 @@ module C3 = {
8686
\"DefaultValueProp$C3"
8787
}
8888
}
89+
let \"DefaultValueProp$C0" = C0.make and \"DefaultValueProp$C0$jsx" = true
90+
let \"DefaultValueProp$C1" = C1.make and \"DefaultValueProp$C1$jsx" = true
91+
let \"DefaultValueProp$C2" = C2.make and \"DefaultValueProp$C2$jsx" = true
92+
let \"DefaultValueProp$C3" = C3.make and \"DefaultValueProp$C3$jsx" = true

tests/syntax_tests/data/ppx/react/expected/externalWithCustomName.res.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ module Foo = {
1111
external component: React.component<props<int, string>> = "component"
1212
}
1313

14-
let t = React.jsx(Foo.component, {a: 1, b: {"1"}})
14+
let t = React.jsx(@res.jsxComponentPath Foo.component, {a: 1, b: {"1"}})

tests/syntax_tests/data/ppx/react/expected/fileLevelConfig.res.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@ module V4A = {
1515
\"FileLevelConfig$V4A"
1616
}
1717
}
18+
let \"FileLevelConfig$V4A" = V4A.make and \"FileLevelConfig$V4A$jsx" = true

tests/syntax_tests/data/ppx/react/expected/forwardRef.res.txt

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,10 @@ module V4A = {
4545
"div",
4646
{
4747
children: ?ReactDOM.someElement(
48-
React.jsx(FancyInput.make, {ref: input, children: {React.string("Click to focus")}}),
48+
React.jsx(
49+
@res.jsxComponentPath FancyInput.make,
50+
{ref: input, children: {React.string("Click to focus")}},
51+
),
4952
),
5053
},
5154
): React.element
@@ -103,7 +106,10 @@ module V4AUncurried = {
103106
"div",
104107
{
105108
children: ?ReactDOM.someElement(
106-
React.jsx(FancyInput.make, {ref: input, children: {React.string("Click to focus")}}),
109+
React.jsx(
110+
@res.jsxComponentPath FancyInput.make,
111+
{ref: input, children: {React.string("Click to focus")}},
112+
),
107113
),
108114
},
109115
): React.element
@@ -115,3 +121,8 @@ module V4AUncurried = {
115121
\"ForwardRef$V4AUncurried"
116122
}
117123
}
124+
let \"ForwardRef$V4A$FancyInput" = V4A.FancyInput.make and \"ForwardRef$V4A$FancyInput$jsx" = true
125+
let \"ForwardRef$V4A" = V4A.make and \"ForwardRef$V4A$jsx" = true
126+
let \"ForwardRef$V4AUncurried$FancyInput" = V4AUncurried.FancyInput.make
127+
and \"ForwardRef$V4AUncurried$FancyInput$jsx" = true
128+
let \"ForwardRef$V4AUncurried" = V4AUncurried.make and \"ForwardRef$V4AUncurried$jsx" = true

tests/syntax_tests/data/ppx/react/expected/fragment.res.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ let _ = React.jsxs(
77
{children: React.array([ReactDOM.jsx("div", {}), ReactDOM.jsx("div", {})])},
88
)
99
let _ = React.jsx(React.jsxFragment, {children: React.jsx(React.jsxFragment, {})})
10-
let _ = React.jsx(Z.make, {})
11-
let _ = React.jsx(Z.make, {children: ReactDOM.jsx("div", {})})
12-
let _ = React.jsx(Z.make, {a: "a", children: ReactDOM.jsx("div", {})})
10+
let _ = React.jsx(@res.jsxComponentPath Z.make, {})
11+
let _ = React.jsx(@res.jsxComponentPath Z.make, {children: ReactDOM.jsx("div", {})})
12+
let _ = React.jsx(@res.jsxComponentPath Z.make, {a: "a", children: ReactDOM.jsx("div", {})})
1313
let _ = React.jsxs(
14-
Z.make,
14+
@res.jsxComponentPath Z.make,
1515
{children: React.array([ReactDOM.jsx("div", {}), ReactDOM.jsx("div", {})])},
1616
)
1717
let _ = ReactDOM.jsx("div", {})

tests/syntax_tests/data/ppx/react/expected/interface.res.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,5 @@ module NoProps = {
2121
\"Interface$NoProps"
2222
}
2323
}
24+
let \"Interface$A" = A.make and \"Interface$A$jsx" = true
25+
let \"Interface$NoProps" = NoProps.make and \"Interface$NoProps$jsx" = true

tests/syntax_tests/data/ppx/react/expected/mangleKeyword.res.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,6 @@ module C4A1 = {
2525
external make: React.component<props<string, string>> = "default"
2626
}
2727

28-
let c4a0 = React.jsx(C4A0.make, {_open: "x", _type: "t"})
29-
let c4a1 = React.jsx(C4A1.make, {_open: "x", _type: "t"})
28+
let c4a0 = React.jsx(@res.jsxComponentPath C4A0.make, {_open: "x", _type: "t"})
29+
let c4a1 = React.jsx(@res.jsxComponentPath C4A1.make, {_open: "x", _type: "t"})
30+
let \"MangleKeyword$C4A0" = C4A0.make and \"MangleKeyword$C4A0$jsx" = true

0 commit comments

Comments
 (0)