@@ -912,7 +912,7 @@ namespace ts {
912
912
// Note: it is not actually necessary to save/restore the context flags here. That's
913
913
// because the saving/restoring of these flags happens naturally through the recursive
914
914
// 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.
916
916
const saveContextFlags = contextFlags ;
917
917
918
918
// If we're only looking ahead, then tell the scanner to only lookahead as well.
@@ -2765,7 +2765,7 @@ namespace ts {
2765
2765
// Note: for ease of implementation we treat productions '2' and '3' as the same thing.
2766
2766
// (i.e. they're both BinaryExpressions with an assignment operator in it).
2767
2767
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 ').
2769
2769
if ( isYieldExpression ( ) ) {
2770
2770
return parseYieldExpression ( ) ;
2771
2771
}
@@ -3373,24 +3373,44 @@ namespace ts {
3373
3373
}
3374
3374
3375
3375
/**
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]
3377
3381
*
3378
- * ES7 UnaryExpression:
3379
- * 1) SimpleUnaryExpression[?yield]
3380
- * 2) IncrementExpression[?yield] ** UnaryExpression[?yield]
3381
3382
*/
3382
3383
function parseUnaryExpressionOrHigher ( ) : UnaryExpression | BinaryExpression {
3383
3384
if ( isAwaitExpression ( ) ) {
3384
3385
return parseAwaitExpression ( ) ;
3385
3386
}
3386
3387
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 ( ) ) {
3388
3397
const incrementExpression = parseIncrementExpression ( ) ;
3389
3398
return token ( ) === SyntaxKind . AsteriskAsteriskToken ?
3390
3399
< BinaryExpression > parseBinaryExpressionRest ( getBinaryOperatorPrecedence ( ) , incrementExpression ) :
3391
3400
incrementExpression ;
3392
3401
}
3393
3402
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
+ */
3394
3414
const unaryOperator = token ( ) ;
3395
3415
const simpleUnaryExpression = parseSimpleUnaryExpression ( ) ;
3396
3416
if ( token ( ) === SyntaxKind . AsteriskAsteriskToken ) {
@@ -3408,8 +3428,8 @@ namespace ts {
3408
3428
/**
3409
3429
* Parse ES7 simple-unary expression or higher:
3410
3430
*
3411
- * ES7 SimpleUnaryExpression :
3412
- * 1) IncrementExpression [?yield]
3431
+ * ES7 UnaryExpression :
3432
+ * 1) UpdateExpression [?yield]
3413
3433
* 2) delete UnaryExpression[?yield]
3414
3434
* 3) void UnaryExpression[?yield]
3415
3435
* 4) typeof UnaryExpression[?yield]
@@ -3447,14 +3467,14 @@ namespace ts {
3447
3467
/**
3448
3468
* Check if the current token can possibly be an ES7 increment expression.
3449
3469
*
3450
- * ES7 IncrementExpression :
3470
+ * ES7 UpdateExpression :
3451
3471
* LeftHandSideExpression[?Yield]
3452
3472
* LeftHandSideExpression[?Yield][no LineTerminator here]++
3453
3473
* LeftHandSideExpression[?Yield][no LineTerminator here]--
3454
3474
* ++LeftHandSideExpression[?Yield]
3455
3475
* --LeftHandSideExpression[?Yield]
3456
3476
*/
3457
- function isIncrementExpression ( ) : boolean {
3477
+ function isUpdateExpression ( ) : boolean {
3458
3478
// This function is called inside parseUnaryExpression to decide
3459
3479
// whether to call parseSimpleUnaryExpression or call parseIncrementExpression directly
3460
3480
switch ( token ( ) ) {
0 commit comments