-
Notifications
You must be signed in to change notification settings - Fork 457
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
base: master
Are you sure you want to change the base?
Jsx ast #7286
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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 |
||
(* | ||
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 comment
The reason will be displayed to describe this comment to others. Learn more.
Are
::
and()
still used?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, for JSX tag.