@@ -2190,7 +2190,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
21902190 emit ( node . right ) ;
21912191 }
21922192
2193- function emitEntityNameAsExpression ( node : EntityName , useFallback : boolean ) {
2193+ function emitEntityNameAsExpression ( node : EntityName | Expression , useFallback : boolean ) {
21942194 switch ( node . kind ) {
21952195 case SyntaxKind . Identifier :
21962196 if ( useFallback ) {
@@ -2205,6 +2205,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
22052205 case SyntaxKind . QualifiedName :
22062206 emitQualifiedNameAsExpression ( < QualifiedName > node , useFallback ) ;
22072207 break ;
2208+
2209+ default :
2210+ emitNodeWithoutSourceMap ( node ) ;
2211+ break ;
22082212 }
22092213 }
22102214
@@ -2978,7 +2982,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
29782982 }
29792983 else {
29802984 // this is top level converted loop so we need to create an alias for 'this' here
2981- // NOTE:
2985+ // NOTE:
29822986 // if converted loops were all nested in arrow function then we'll always emit '_this' so convertedLoopState.thisName will not be set.
29832987 // If it is set this means that all nested loops are not nested in arrow function and it is safe to capture 'this'.
29842988 write ( `var ${ convertedLoopState . thisName } = this;` ) ;
@@ -4273,7 +4277,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
42734277 }
42744278 if ( node . kind === SyntaxKind . FunctionDeclaration ) {
42754279 // Emit name if one is present, or emit generated name in down-level case (for export default case)
4276- return ! ! node . name || languageVersion < ScriptTarget . ES6 ;
4280+ return ! ! node . name || modulekind !== ModuleKind . ES6 ;
42774281 }
42784282 }
42794283
@@ -4455,18 +4459,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
44554459
44564460 write ( " __awaiter(this" ) ;
44574461 if ( hasLexicalArguments ) {
4458- write ( ", arguments" ) ;
4462+ write ( ", arguments, " ) ;
44594463 }
44604464 else {
4461- write ( ", void 0" ) ;
4465+ write ( ", void 0, " ) ;
44624466 }
44634467
44644468 if ( promiseConstructor ) {
4465- write ( ", " ) ;
4466- emitNodeWithoutSourceMap ( promiseConstructor ) ;
4469+ emitEntityNameAsExpression ( promiseConstructor , /*useFallback*/ false ) ;
44674470 }
44684471 else {
4469- write ( ", Promise" ) ;
4472+ write ( "Promise" ) ;
44704473 }
44714474
44724475 // Emit the call to __awaiter.
@@ -4527,7 +4530,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
45274530 }
45284531
45294532 const isAsync = isAsyncFunctionLike ( node ) ;
4530- if ( isAsync && languageVersion === ScriptTarget . ES6 ) {
4533+ if ( isAsync ) {
45314534 emitAsyncFunctionBodyForES6 ( node ) ;
45324535 }
45334536 else {
@@ -5108,7 +5111,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
51085111 // emit name if
51095112 // - node has a name
51105113 // - this is default export with static initializers
5111- if ( ( node . name || ( node . flags & NodeFlags . Default && staticProperties . length > 0 ) ) && ! thisNodeIsDecorated ) {
5114+ if ( ( node . name || ( node . flags & NodeFlags . Default && ( staticProperties . length > 0 || modulekind !== ModuleKind . ES6 ) ) ) && ! thisNodeIsDecorated ) {
51125115 write ( " " ) ;
51135116 emitDeclarationName ( node ) ;
51145117 }
@@ -5729,7 +5732,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
57295732 }
57305733
57315734 /** Serializes the return type of function. Used by the __metadata decorator for a method. */
5732- function emitSerializedReturnTypeOfNode ( node : Node ) : string | string [ ] {
5735+ function emitSerializedReturnTypeOfNode ( node : Node ) {
57335736 if ( node && isFunctionLike ( node ) && ( < FunctionLikeDeclaration > node ) . type ) {
57345737 emitSerializedTypeNode ( ( < FunctionLikeDeclaration > node ) . type ) ;
57355738 return ;
@@ -7823,7 +7826,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
78237826 function emitFile ( { jsFilePath, sourceMapFilePath, declarationFilePath} : { jsFilePath : string , sourceMapFilePath : string , declarationFilePath : string } ,
78247827 sourceFiles : SourceFile [ ] , isBundledEmit : boolean ) {
78257828 // Make sure not to write js File and source map file if any of them cannot be written
7826- if ( ! host . isEmitBlocked ( jsFilePath ) ) {
7829+ if ( ! host . isEmitBlocked ( jsFilePath ) && ! compilerOptions . noEmit ) {
78277830 emitJavaScript ( jsFilePath , sourceMapFilePath , sourceFiles , isBundledEmit ) ;
78287831 }
78297832 else {
0 commit comments