@@ -557,7 +557,13 @@ namespace ts {
557
557
modifiers
558
558
) ;
559
559
node . name = asName ( name ) ;
560
- node . transformFlags |= propagateChildFlags ( node . name ) ;
560
+ node . transformFlags |=
561
+ kind === SyntaxKind . MethodDeclaration ||
562
+ kind === SyntaxKind . GetAccessor ||
563
+ kind === SyntaxKind . SetAccessor ||
564
+ kind === SyntaxKind . PropertyDeclaration ?
565
+ propagatePropertyNameFlags ( node . name ) :
566
+ propagateChildFlags ( node . name ) ;
561
567
return node ;
562
568
}
563
569
@@ -824,6 +830,9 @@ namespace ts {
824
830
// NOTE: we do not use `setChildren` here because typeArguments in an identifier do not contribute to transformations
825
831
node . typeArguments = createNodeArray ( typeArguments ) ;
826
832
}
833
+ if ( node . originalKeywordKind === SyntaxKind . AwaitKeyword ) {
834
+ node . transformFlags |= TransformFlags . ContainsPossibleTopLevelAwait ;
835
+ }
827
836
return node ;
828
837
}
829
838
@@ -2094,7 +2103,7 @@ namespace ts {
2094
2103
node . name = asName ( name ) ;
2095
2104
node . transformFlags =
2096
2105
propagateChildFlags ( node . expression ) |
2097
- propagateChildFlags ( node . name ) ;
2106
+ propagatePropertyNameFlags ( node . name ) ;
2098
2107
if ( isSuperKeyword ( expression ) ) {
2099
2108
// super method calls require a lexical 'this'
2100
2109
// super method calls require 'super' hoisting in ES2017 and ES2018 async functions and async generators
@@ -5777,14 +5786,23 @@ namespace ts {
5777
5786
return tokenValue ;
5778
5787
}
5779
5788
5780
- function propagatePropertyNameFlags ( node : PropertyName , transformFlags : TransformFlags ) {
5789
+ function propagatePropertyNameFlags ( node : Node | undefined ) {
5790
+ if ( ! node ) return TransformFlags . None ;
5791
+ // `await` in a property name should not be considered a possible top-level await keyword
5792
+ const transformFlags = propagateChildFlags ( node ) ;
5793
+ return isIdentifier ( node ) ?
5794
+ transformFlags & ~ TransformFlags . ContainsPossibleTopLevelAwait :
5795
+ transformFlags ;
5796
+ }
5797
+
5798
+ function propagatePropertyNameFlagsOfChild ( node : PropertyName , transformFlags : TransformFlags ) {
5781
5799
return transformFlags | ( node . transformFlags & TransformFlags . PropertyNamePropagatingFlags ) ;
5782
5800
}
5783
5801
5784
5802
function propagateChildFlags ( child : Node | undefined ) : TransformFlags {
5785
5803
if ( ! child ) return TransformFlags . None ;
5786
5804
const childFlags = child . transformFlags & ~ getTransformFlagsSubtreeExclusions ( child . kind ) ;
5787
- return isNamedDeclaration ( child ) && isPropertyName ( child . name ) ? propagatePropertyNameFlags ( child . name , childFlags ) : childFlags ;
5805
+ return isNamedDeclaration ( child ) && isPropertyName ( child . name ) ? propagatePropertyNameFlagsOfChild ( child . name , childFlags ) : childFlags ;
5788
5806
}
5789
5807
5790
5808
function propagateChildrenFlags ( children : NodeArray < Node > | undefined ) : TransformFlags {
0 commit comments