Conversation
|
Are there any comments? Could we merge this? I’d like to see this functionality adopted in parsers, so it’s important to see this extension in the language. |
|
Seems fine to me. Merged. |
| - JSXText | ||
| - JSXElement | ||
| - `{` AssignmentExpression<sub>opt</sub> `}` | ||
| - `{` JSXChildExpression `}` |
There was a problem hiding this comment.
nit: I would put opt here. as it was before Technically it doesn't matter for the grammar, but would be cleaner to see that the content between braces is optional.
There was a problem hiding this comment.
Yeah, I like that better too 😉
|
@calebmer @sebmarkbage Does anyone remember why we introduced a separate node type for this and not reused |
|
@RReverser I don’t think there was a specific reason. I defaulted to creating a new type which may be better for extensibility in the future. |
|
What does ESTree do for spread properties (object spread)? |
interface SpreadElement <: Node {
type: "SpreadElement";
argument: Expression;
} |
|
@sebmarkbage Ah sorry, just realised that I misunderstood your question. See https://github.com/estree/estree/blob/master/experimental/rest-spread-properties.md - it also reuses |
|
I'm skeptical of seeking reuse for things that are specified as separate things in the syntax spec. It seems like a fragile future compatibility issue and convenience issue. E.g. for matchers in Babel or for implementing evaluators. According to the last TC39 meeting, rest properties will no longer allow a nested pattern - unlike rest element. Only identifiers. So they've already diverged and might diverge more in the future. |
|
shrugs AST is mostly for syntactic representation of things, there are better IRs for evaluators and checkers. And syntactically this is indeed |
Summary: In facebook/jsx#59 spread children were added to the JSX specification. This adds type checking and parsing for spread children for CSX. Reviewed By: calebmer Differential Revision: D6236379 fbshipit-source-id: 5eca3b7b3748a47ff25e257fcb3c4778a73a5495
As per discussions in #57 and babel/babylon#42.
This syntax is the same one I used in writing babel/babylon#42
cc @syranide, @sebmarkbage, @kittens