-
Notifications
You must be signed in to change notification settings - Fork 131
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
RFC: React Expressions with Explicit Generator Expression Semantics #99
base: main
Are you sure you want to change the base?
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 |
---|---|---|
|
@@ -40,6 +40,7 @@ PrimaryExpression : | |
|
||
- JSXElement | ||
- JSXFragment | ||
- JSXGeneratorExpressionContainer | ||
|
||
__Elements__ | ||
|
||
|
@@ -115,9 +116,21 @@ JSXAttributeValue : | |
- `"` JSXDoubleStringCharacters<sub>opt</sub> `"` | ||
- `'` JSXSingleStringCharacters<sub>opt</sub> `'` | ||
- `{` AssignmentExpression `}` | ||
- JSXGeneratorExpressionContainer | ||
- JSXElement | ||
- JSXFragment | ||
|
||
JSXGeneratorExpressionContainer : | ||
- `*` `{` JSXGeneratorExpression<sub>opt</sub> `}` | ||
|
||
JSXGeneratorExpression : | ||
- ObjectLiteral | ||
- FunctionExpression | ||
- ClassExpression | ||
- GeneratorExpression | ||
- AsyncFunctionExpression | ||
- FunctionBody<sub>[+Yield, ~Await, ~Return]</sub> | ||
|
||
JSXDoubleStringCharacters : | ||
|
||
- JSXDoubleStringCharacter JSXDoubleStringCharacters<sub>opt</sub> | ||
|
@@ -145,15 +158,17 @@ JSXChild : | |
- JSXText | ||
- JSXElement | ||
- JSXFragment | ||
- JSXGeneratorExpressionContainer | ||
- `{` JSXChildExpression<sub>opt</sub> `}` | ||
|
||
JSXText : | ||
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. We'll need a disambiguator in JSXText for Note that <div>* /* hello */ { yield 1; }</div> |
||
|
||
- JSXTextCharacter JSXText<sub>opt</sub> | ||
- [lookahead ∉ { `{` }] `*` JSXText<sub>opt</sub> | ||
|
||
JSXTextCharacter : | ||
|
||
- SourceCharacter __but not one of `{`, `<`, `>` or `}`__ | ||
- SourceCharacter __but not one of `*`, `{`, `<`, `>` or `}`__ | ||
|
||
JSXChildExpression : | ||
|
||
|
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.
FunctionBody
is ambiguous since it also includesBlockStatement
,FunctionDeclaration
,ClassDeclaration
,GeneratorExpression
andAsyncFunctionDeclaration
.We need to exclude them from the list. Either by defining our own statement list explicitly, or by excluding these by some kind of lookahead.
E.g. an explicit list could look something like this:
(This also highlights the maintenance cost associated with forking the language.)
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.
Ah I see, this is a problem with the other proposal as well, and I'm not sure there's a way to lower the maintenance cost by a significant amount. Either way, we'll need to keep adding to lookaheads or
JSXStatementListFirstItem
for new ECMAScript features. For now I'll just go with the lookahead approach - we just can't have{
,class
,async
,function
, anddo
right?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.
Wondering what to do for
(
...