-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Update parser comment with es7 grammar #10459
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
Merged
Merged
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -912,7 +912,7 @@ namespace ts { | |
| // Note: it is not actually necessary to save/restore the context flags here. That's | ||
| // because the saving/restoring of these flags happens naturally through the recursive | ||
| // descent nature of our parser. However, we still store this here just so we can | ||
| // assert that that invariant holds. | ||
| // assert that invariant holds. | ||
| const saveContextFlags = contextFlags; | ||
|
|
||
| // If we're only looking ahead, then tell the scanner to only lookahead as well. | ||
|
|
@@ -2765,7 +2765,7 @@ namespace ts { | |
| // Note: for ease of implementation we treat productions '2' and '3' as the same thing. | ||
| // (i.e. they're both BinaryExpressions with an assignment operator in it). | ||
|
|
||
| // First, do the simple check if we have a YieldExpression (production '5'). | ||
| // First, do the simple check if we have a YieldExpression (production '6'). | ||
| if (isYieldExpression()) { | ||
| return parseYieldExpression(); | ||
| } | ||
|
|
@@ -3373,24 +3373,44 @@ namespace ts { | |
| } | ||
|
|
||
| /** | ||
| * Parse ES7 unary expression and await expression | ||
| * Parse ES7 exponential expression and await expression | ||
| * | ||
| * ES7 ExponentiationExpression: | ||
| * 1) UnaryExpression[?Yield] | ||
| * 2) UpdateExpression[?Yield]**ExponentiationExpression[?Yield] | ||
|
||
| * | ||
| * ES7 UnaryExpression: | ||
| * 1) SimpleUnaryExpression[?yield] | ||
| * 2) IncrementExpression[?yield] ** UnaryExpression[?yield] | ||
| */ | ||
| function parseUnaryExpressionOrHigher(): UnaryExpression | BinaryExpression { | ||
| if (isAwaitExpression()) { | ||
| return parseAwaitExpression(); | ||
| } | ||
|
|
||
| if (isIncrementExpression()) { | ||
| /** | ||
| * ES7 UpdateExpression: | ||
| * 1) LeftHandSideExpression[?Yield] | ||
| * 2) LeftHandSideExpression[?Yield][no LineTerminator here]++ | ||
| * 3) LeftHandSideExpression[?Yield][no LineTerminator here]-- | ||
| * 4) ++UnaryExpression[?Yield] | ||
| * 5) --UnaryExpression[?Yield] | ||
| */ | ||
| if (isUpdateExpression()) { | ||
| const incrementExpression = parseIncrementExpression(); | ||
| return token() === SyntaxKind.AsteriskAsteriskToken ? | ||
| <BinaryExpression>parseBinaryExpressionRest(getBinaryOperatorPrecedence(), incrementExpression) : | ||
| incrementExpression; | ||
| } | ||
|
|
||
| /** | ||
| * ES7 UnaryExpression: | ||
| * 1) UpdateExpression[?yield] | ||
| * 2) delete UpdateExpression[?yield] | ||
| * 3) void UpdateExpression[?yield] | ||
| * 4) typeof UpdateExpression[?yield] | ||
| * 5) + UpdateExpression[?yield] | ||
| * 6) - UpdateExpression[?yield] | ||
| * 7) ~ UpdateExpression[?yield] | ||
| * 8) ! UpdateExpression[?yield] | ||
| */ | ||
| const unaryOperator = token(); | ||
| const simpleUnaryExpression = parseSimpleUnaryExpression(); | ||
| if (token() === SyntaxKind.AsteriskAsteriskToken) { | ||
|
|
@@ -3408,8 +3428,8 @@ namespace ts { | |
| /** | ||
| * Parse ES7 simple-unary expression or higher: | ||
| * | ||
| * ES7 SimpleUnaryExpression: | ||
| * 1) IncrementExpression[?yield] | ||
| * ES7 UnaryExpression: | ||
| * 1) UpdateExpression[?yield] | ||
| * 2) delete UnaryExpression[?yield] | ||
| * 3) void UnaryExpression[?yield] | ||
| * 4) typeof UnaryExpression[?yield] | ||
|
|
@@ -3447,14 +3467,14 @@ namespace ts { | |
| /** | ||
| * Check if the current token can possibly be an ES7 increment expression. | ||
| * | ||
| * ES7 IncrementExpression: | ||
| * ES7 UpdateExpression: | ||
| * LeftHandSideExpression[?Yield] | ||
| * LeftHandSideExpression[?Yield][no LineTerminator here]++ | ||
| * LeftHandSideExpression[?Yield][no LineTerminator here]-- | ||
| * ++LeftHandSideExpression[?Yield] | ||
| * --LeftHandSideExpression[?Yield] | ||
| */ | ||
| function isIncrementExpression(): boolean { | ||
| function isUpdateExpression(): boolean { | ||
| // This function is called inside parseUnaryExpression to decide | ||
| // whether to call parseSimpleUnaryExpression or call parseIncrementExpression directly | ||
| switch (token()) { | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Is this related?
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.
opps I am using mac and the machine time out. I can roll back though would love to keep it so I can run on my mac 😸