Skip to content

Commit 28aa287

Browse files
committed
Initial mapping from0
1 parent db7eee6 commit 28aa287

File tree

4 files changed

+14
-1
lines changed

4 files changed

+14
-1
lines changed

compiler/ml/ast_mapper_from0.ml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,10 @@ module E = struct
358358
match_ ~loc ~attrs (sub.expr sub e) (sub.cases sub pel)
359359
| Pexp_try (e, pel) -> try_ ~loc ~attrs (sub.expr sub e) (sub.cases sub pel)
360360
| Pexp_tuple el -> tuple ~loc ~attrs (List.map (sub.expr sub) el)
361+
| Pexp_construct ({txt = Longident.Lident "[]"}, None)
362+
when attrs |> List.exists (fun ({txt}, _) -> txt == "JSX") ->
363+
let attrs = attrs |> List.filter (fun ({txt}, _) -> txt != "JSX") in
364+
jsx_fragment ~loc ~attrs loc.loc_start [] loc.loc_end
361365
| Pexp_construct (lid, arg) -> (
362366
let lid1 = map_loc sub lid in
363367
let arg1 = map_opt (sub.expr sub) arg in

tests/tools_tests/package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/tools_tests/ppx/TestPpx.res

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,7 @@ let eq2 = 3 === 3
6161

6262
let test = async () => 12
6363
let f = async () => (await test()) + 1
64+
65+
module Fragments = {
66+
let f1 = <></>
67+
}

tests/tools_tests/src/expected/TestPpx.res.jsout

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,10 @@ async function f() {
8080
return await test() + 1 | 0;
8181
}
8282

83+
let Fragments = {
84+
f1: /* [] */0
85+
};
86+
8387
let a = "A";
8488

8589
let b = "B";
@@ -114,4 +118,5 @@ exports.eq = eq;
114118
exports.eq2 = eq2;
115119
exports.test = test;
116120
exports.f = f;
121+
exports.Fragments = Fragments;
117122
/* Not a pure module */

0 commit comments

Comments
 (0)