Skip to content

Commit

Permalink
Merge pull request #59 from calebmer/feat/spread-children
Browse files Browse the repository at this point in the history
Add JSXSpreadChild
  • Loading branch information
sebmarkbage authored Jul 2, 2016
2 parents 3f745f4 + 91131d7 commit 94bc381
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
11 changes: 10 additions & 1 deletion AST.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,15 @@ interface JSXExpressionContainer <: Node {
}
```

A JSX element uses a special form of an expression container for an iterator child who should be “spread out” inside an element’s children list:

```js
interface JSXSpreadChild <: Node {
type: "JSXSpreadChild",
expression: Expression
}
```

JSX Boundary Tags
-----------------

Expand Down Expand Up @@ -110,7 +119,7 @@ Finally, JSX element itself consists of opening element, list of children and op
interface JSXElement <: Expression {
type: "JSXElement",
openingElement: JSXOpeningElement,
children: [ Literal | JSXExpressionContainer | JSXElement ],
children: [ Literal | JSXExpressionContainer | JSXSpreadChild | JSXElement ],
closingElement: JSXClosingElement | null
}
```
Expand Down
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ JSXChild :

- JSXText
- JSXElement
- `{` AssignmentExpression<sub>opt</sub> `}`
- `{` JSXChildExpression `}`

JSXText :

Expand All @@ -148,6 +148,11 @@ JSXTextCharacter :

- SourceCharacter __but not one of `{`, `<`, `>` or `}`__

JSXChildExpression :

- AssignmentExpression<sub>opt</sub>
- `...` AssignmentExpression

__Whitespace and Comments__

_JSX uses the same punctuators and braces as ECMAScript. WhiteSpace, LineTerminators and Comments are generally allowed between any punctuators._
Expand Down

0 comments on commit 94bc381

Please sign in to comment.