-
Notifications
You must be signed in to change notification settings - Fork 470
Jsx ast #7286
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Jsx ast #7286
Changes from 3 commits
db7eee6
28aa287
b57f2df
32161a3
d714829
e27b339
92657ee
441de6e
bf1b411
5fe5f12
9251609
1aaa686
b374212
c91aeda
85ccab4
86c9f5f
0dfd5b6
203ff25
a273f2e
998edbe
fcf2d90
162b7a2
9b815a0
9408d06
cc5beb4
02e9fc9
5e060ea
e57ab30
b6407d0
e565ca7
84e9cbe
bbfe816
63fc87b
d6c9fa8
e446ae1
5fef337
251244b
aec0d8e
6a3f4c9
506dda3
96839f4
ff1bb65
91c283e
2b9b5ce
0133f91
aaef8ac
b863888
7f8bf01
4e0951c
7843795
9e68c1a
53616a7
25e20b8
ad72bf2
7ba4996
f09cd70
aa1d978
0ee7601
bd45146
2d50ff8
fcabcff
ddcdaa2
52ecf03
cd9059f
2e9fb66
37755ae
3a434c9
6cf1e71
ae9b428
f3b96df
b1f8dfe
64001e2
8148cf5
cfc4669
2946ea0
4fcc3ce
161b12c
cd98c9f
67da647
86fea57
f10bc55
b40c019
28497d2
e7bf344
b8d609e
6d15369
88534ba
210fa87
8373814
d92d7c5
d9b59dd
4e160f3
93eb5af
6152b83
2126fc9
645b244
a0c0d0d
f1da36f
80c307a
5e5dabd
091f1a3
11ced99
0c825d5
8ff481d
8723426
a1e4ca9
e1ad251
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ⭐ |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -407,6 +407,18 @@ module E = struct | |
| Pexp_open (ovf, lid, e) -> | ||
open_ ~loc ~attrs ovf (map_loc sub lid) (sub.expr sub e) | ||
| Pexp_extension x -> extension ~loc ~attrs (sub.extension sub x) | ||
| Pexp_jsx_fragment (o, xs, c) -> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There should be a corresponding change in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Alright, I think the new tests from #7318 prove this now. |
||
(* | ||
The location of Pexp_jsx_fragment is from the start of < till the end of />. | ||
This is not the case in the old AST. There it is from >...</ | ||
*) | ||
let loc = {loc with loc_start = o; loc_end = c} in | ||
let list_expr = Ast_helper.Exp.make_list_expression loc xs None in | ||
let mapped = sub.expr sub list_expr in | ||
let jsx_attr = | ||
sub.attribute sub (Location.mknoloc "JSX", Parsetree.PStr []) | ||
in | ||
{mapped with pexp_attributes = jsx_attr :: attrs} | ||
end | ||
|
||
module P = struct | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -313,8 +313,14 @@ and expression_desc = | |
let open M in E | ||
let! open M in E *) | ||
| Pexp_extension of extension | ||
(* [%id] *) | ||
(* . *) | ||
(* [%id] *) | ||
(* . *) | ||
(* represents <> foo </> , the entire range is stored in the expression , we keep track of >, children and </ *) | ||
| Pexp_jsx_fragment of | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The reason the store the If we ever want to restore comments I suppose we need the proper anchors. |
||
(* > *) Lexing.position | ||
* (* children *) | ||
expression list | ||
* (* </ *) Lexing.position | ||
|
||
and case = { | ||
(* (P -> E) or (P when E0 -> E) *) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Very cool to get this in the actual printer now. |
Uh oh!
There was an error while loading. Please reload this page.