@@ -912,7 +912,7 @@ namespace ts {
912912 // Note: it is not actually necessary to save/restore the context flags here. That's
913913 // because the saving/restoring of these flags happens naturally through the recursive
914914 // descent nature of our parser. However, we still store this here just so we can
915- // assert that that invariant holds.
915+ // assert that invariant holds.
916916 const saveContextFlags = contextFlags ;
917917
918918 // If we're only looking ahead, then tell the scanner to only lookahead as well.
@@ -2765,7 +2765,7 @@ namespace ts {
27652765 // Note: for ease of implementation we treat productions '2' and '3' as the same thing.
27662766 // (i.e. they're both BinaryExpressions with an assignment operator in it).
27672767
2768- // First, do the simple check if we have a YieldExpression (production '5 ').
2768+ // First, do the simple check if we have a YieldExpression (production '6 ').
27692769 if ( isYieldExpression ( ) ) {
27702770 return parseYieldExpression ( ) ;
27712771 }
@@ -3373,24 +3373,44 @@ namespace ts {
33733373 }
33743374
33753375 /**
3376- * Parse ES7 unary expression and await expression
3376+ * Parse ES7 exponential expression and await expression
3377+ *
3378+ * ES7 ExponentiationExpression:
3379+ * 1) UnaryExpression[?Yield]
3380+ * 2) UpdateExpression[?Yield] ** ExponentiationExpression[?Yield]
33773381 *
3378- * ES7 UnaryExpression:
3379- * 1) SimpleUnaryExpression[?yield]
3380- * 2) IncrementExpression[?yield] ** UnaryExpression[?yield]
33813382 */
33823383 function parseUnaryExpressionOrHigher ( ) : UnaryExpression | BinaryExpression {
33833384 if ( isAwaitExpression ( ) ) {
33843385 return parseAwaitExpression ( ) ;
33853386 }
33863387
3387- if ( isIncrementExpression ( ) ) {
3388+ /**
3389+ * ES7 UpdateExpression:
3390+ * 1) LeftHandSideExpression[?Yield]
3391+ * 2) LeftHandSideExpression[?Yield][no LineTerminator here]++
3392+ * 3) LeftHandSideExpression[?Yield][no LineTerminator here]--
3393+ * 4) ++UnaryExpression[?Yield]
3394+ * 5) --UnaryExpression[?Yield]
3395+ */
3396+ if ( isUpdateExpression ( ) ) {
33883397 const incrementExpression = parseIncrementExpression ( ) ;
33893398 return token ( ) === SyntaxKind . AsteriskAsteriskToken ?
33903399 < BinaryExpression > parseBinaryExpressionRest ( getBinaryOperatorPrecedence ( ) , incrementExpression ) :
33913400 incrementExpression ;
33923401 }
33933402
3403+ /**
3404+ * ES7 UnaryExpression:
3405+ * 1) UpdateExpression[?yield]
3406+ * 2) delete UpdateExpression[?yield]
3407+ * 3) void UpdateExpression[?yield]
3408+ * 4) typeof UpdateExpression[?yield]
3409+ * 5) + UpdateExpression[?yield]
3410+ * 6) - UpdateExpression[?yield]
3411+ * 7) ~ UpdateExpression[?yield]
3412+ * 8) ! UpdateExpression[?yield]
3413+ */
33943414 const unaryOperator = token ( ) ;
33953415 const simpleUnaryExpression = parseSimpleUnaryExpression ( ) ;
33963416 if ( token ( ) === SyntaxKind . AsteriskAsteriskToken ) {
@@ -3408,8 +3428,8 @@ namespace ts {
34083428 /**
34093429 * Parse ES7 simple-unary expression or higher:
34103430 *
3411- * ES7 SimpleUnaryExpression :
3412- * 1) IncrementExpression [?yield]
3431+ * ES7 UnaryExpression :
3432+ * 1) UpdateExpression [?yield]
34133433 * 2) delete UnaryExpression[?yield]
34143434 * 3) void UnaryExpression[?yield]
34153435 * 4) typeof UnaryExpression[?yield]
@@ -3447,14 +3467,14 @@ namespace ts {
34473467 /**
34483468 * Check if the current token can possibly be an ES7 increment expression.
34493469 *
3450- * ES7 IncrementExpression :
3470+ * ES7 UpdateExpression :
34513471 * LeftHandSideExpression[?Yield]
34523472 * LeftHandSideExpression[?Yield][no LineTerminator here]++
34533473 * LeftHandSideExpression[?Yield][no LineTerminator here]--
34543474 * ++LeftHandSideExpression[?Yield]
34553475 * --LeftHandSideExpression[?Yield]
34563476 */
3457- function isIncrementExpression ( ) : boolean {
3477+ function isUpdateExpression ( ) : boolean {
34583478 // This function is called inside parseUnaryExpression to decide
34593479 // whether to call parseSimpleUnaryExpression or call parseIncrementExpression directly
34603480 switch ( token ( ) ) {
0 commit comments