@@ -2555,6 +2555,11 @@ namespace ts {
2555
2555
// extends clause of a class.
2556
2556
let transformFlags = subtreeFlags | TransformFlags . AssertES6 ;
2557
2557
2558
+ // propagate ES2017
2559
+ if ( node . expression . transformFlags & TransformFlags . ContainsES2017 ) {
2560
+ transformFlags |= TransformFlags . ContainsES2017 ;
2561
+ }
2562
+
2558
2563
// If an ExpressionWithTypeArguments contains type arguments, then it
2559
2564
// is TypeScript syntax.
2560
2565
if ( node . typeArguments ) {
@@ -2595,6 +2600,11 @@ namespace ts {
2595
2600
transformFlags |= TransformFlags . AssertTypeScript ;
2596
2601
}
2597
2602
2603
+ // Async MethodDeclaration is ES2017
2604
+ if ( modifierFlags & ModifierFlags . Async ) {
2605
+ transformFlags |= TransformFlags . AssertES2017 ;
2606
+ }
2607
+
2598
2608
// Currently, we only support generators that were originally async function bodies.
2599
2609
if ( asteriskToken && getEmitFlags ( node ) & EmitFlags . AsyncFunctionBody ) {
2600
2610
transformFlags |= TransformFlags . AssertGenerator ;
@@ -2656,7 +2666,7 @@ namespace ts {
2656
2666
2657
2667
// If a FunctionDeclaration is async, then it is TypeScript syntax.
2658
2668
if ( modifierFlags & ModifierFlags . Async ) {
2659
- transformFlags |= TransformFlags . AssertTypeScript ;
2669
+ transformFlags |= TransformFlags . AssertTypeScript | TransformFlags . AssertES2017 ;
2660
2670
}
2661
2671
2662
2672
// If a FunctionDeclaration's subtree has marked the container as needing to capture the
@@ -2687,7 +2697,7 @@ namespace ts {
2687
2697
2688
2698
// An async function expression is TypeScript syntax.
2689
2699
if ( modifierFlags & ModifierFlags . Async ) {
2690
- transformFlags |= TransformFlags . AssertTypeScript ;
2700
+ transformFlags |= TransformFlags . AssertTypeScript | TransformFlags . AssertES2017 ;
2691
2701
}
2692
2702
2693
2703
// If a FunctionExpression's subtree has marked the container as needing to capture the
@@ -2717,7 +2727,7 @@ namespace ts {
2717
2727
2718
2728
// An async arrow function is TypeScript syntax.
2719
2729
if ( modifierFlags & ModifierFlags . Async ) {
2720
- transformFlags |= TransformFlags . AssertTypeScript ;
2730
+ transformFlags |= TransformFlags . AssertTypeScript | TransformFlags . AssertES2017 ;
2721
2731
}
2722
2732
2723
2733
// If an ArrowFunction contains a lexical this, its container must capture the lexical this.
@@ -2856,14 +2866,18 @@ namespace ts {
2856
2866
let excludeFlags = TransformFlags . NodeExcludes ;
2857
2867
2858
2868
switch ( kind ) {
2869
+ case SyntaxKind . AsyncKeyword :
2870
+ case SyntaxKind . AwaitExpression :
2871
+ // Typescript async/await are ES2017 features
2872
+ transformFlags |= TransformFlags . AssertTypeScript | TransformFlags . AssertES2017 ;
2873
+ break ;
2874
+
2859
2875
case SyntaxKind . PublicKeyword :
2860
2876
case SyntaxKind . PrivateKeyword :
2861
2877
case SyntaxKind . ProtectedKeyword :
2862
2878
case SyntaxKind . AbstractKeyword :
2863
2879
case SyntaxKind . DeclareKeyword :
2864
- case SyntaxKind . AsyncKeyword :
2865
2880
case SyntaxKind . ConstKeyword :
2866
- case SyntaxKind . AwaitExpression :
2867
2881
case SyntaxKind . EnumDeclaration :
2868
2882
case SyntaxKind . EnumMember :
2869
2883
case SyntaxKind . TypeAssertionExpression :
0 commit comments