@@ -153,7 +153,7 @@ namespace ts {
153
153
for ( let i = 0 ; i < numNodes ; i ++ ) {
154
154
const currentNode = bundle ? bundle . sourceFiles [ i ] : node ;
155
155
const sourceFile = isSourceFile ( currentNode ) ? currentNode : currentSourceFile ;
156
- const shouldSkip = compilerOptions . noEmitHelpers || ( sourceFile && getExternalHelpersModuleName ( sourceFile ) !== undefined ) ;
156
+ const shouldSkip = compilerOptions . noEmitHelpers || getExternalHelpersModuleName ( sourceFile ) !== undefined ;
157
157
const shouldBundle = isSourceFile ( currentNode ) && ! isOwnFileEmit ;
158
158
const helpers = getEmitHelpers ( currentNode ) ;
159
159
if ( helpers ) {
@@ -234,6 +234,11 @@ namespace ts {
234
234
writeBundle
235
235
} ;
236
236
237
+ /**
238
+ * If `sourceFile` is `undefined`, `node` must be a synthesized `TypeNode`.
239
+ */
240
+ function printNode ( hint : EmitHint , node : TypeNode , sourceFile : undefined ) : string ;
241
+ function printNode ( hint : EmitHint , node : Node , sourceFile : SourceFile ) : string ;
237
242
function printNode ( hint : EmitHint , node : Node , sourceFile : SourceFile | undefined ) : string {
238
243
switch ( hint ) {
239
244
case EmitHint . SourceFile :
@@ -1112,7 +1117,7 @@ namespace ts {
1112
1117
function emitPropertyAccessExpression ( node : PropertyAccessExpression ) {
1113
1118
let indentBeforeDot = false ;
1114
1119
let indentAfterDot = false ;
1115
- if ( currentSourceFile && ! ( getEmitFlags ( node ) & EmitFlags . NoIndentation ) ) {
1120
+ if ( ! ( getEmitFlags ( node ) & EmitFlags . NoIndentation ) ) {
1116
1121
const dotRangeStart = node . expression . end ;
1117
1122
const dotRangeEnd = skipTrivia ( currentSourceFile . text , node . expression . end ) + 1 ;
1118
1123
const dotToken = < Node > { kind : SyntaxKind . DotToken , pos : dotRangeStart , end : dotRangeEnd } ;
@@ -2520,7 +2525,7 @@ namespace ts {
2520
2525
2521
2526
const firstChild = children [ 0 ] ;
2522
2527
if ( firstChild === undefined ) {
2523
- return ! ( currentSourceFile && rangeIsOnSingleLine ( parentNode , currentSourceFile ) ) ;
2528
+ return ! ( rangeIsOnSingleLine ( parentNode , currentSourceFile ) ) ;
2524
2529
}
2525
2530
else if ( positionIsSynthesized ( parentNode . pos ) || nodeIsSynthesized ( firstChild ) ) {
2526
2531
return synthesizedNodeStartsOnNewLine ( firstChild , format ) ;
@@ -2546,7 +2551,7 @@ namespace ts {
2546
2551
return synthesizedNodeStartsOnNewLine ( previousNode , format ) || synthesizedNodeStartsOnNewLine ( nextNode , format ) ;
2547
2552
}
2548
2553
else {
2549
- return ! ( currentSourceFile && rangeEndIsOnSameLineAsRangeStart ( previousNode , nextNode , currentSourceFile ) ) ;
2554
+ return ! ( rangeEndIsOnSameLineAsRangeStart ( previousNode , nextNode , currentSourceFile ) ) ;
2550
2555
}
2551
2556
}
2552
2557
else {
@@ -2565,13 +2570,13 @@ namespace ts {
2565
2570
2566
2571
const lastChild = lastOrUndefined ( children ) ;
2567
2572
if ( lastChild === undefined ) {
2568
- return ! ( currentSourceFile && rangeIsOnSingleLine ( parentNode , currentSourceFile ) ) ;
2573
+ return ! ( rangeIsOnSingleLine ( parentNode , currentSourceFile ) ) ;
2569
2574
}
2570
2575
else if ( positionIsSynthesized ( parentNode . pos ) || nodeIsSynthesized ( lastChild ) ) {
2571
2576
return synthesizedNodeStartsOnNewLine ( lastChild , format ) ;
2572
2577
}
2573
2578
else {
2574
- return ! ( currentSourceFile && rangeEndPositionsAreOnSameLine ( parentNode , lastChild , currentSourceFile ) ) ;
2579
+ return ! ( rangeEndPositionsAreOnSameLine ( parentNode , lastChild , currentSourceFile ) ) ;
2575
2580
}
2576
2581
}
2577
2582
else {
0 commit comments