@@ -88,7 +88,6 @@ module ts {
8888 let writeLine = writer . writeLine ;
8989 let increaseIndent = writer . increaseIndent ;
9090 let decreaseIndent = writer . decreaseIndent ;
91- let preserveNewLines = compilerOptions . preserveNewLines || false ;
9291
9392 let currentSourceFile : SourceFile ;
9493
@@ -730,7 +729,7 @@ module ts {
730729
731730 increaseIndent ( ) ;
732731
733- if ( preserveNewLines && nodeStartPositionsAreOnSameLine ( parent , nodes [ 0 ] ) ) {
732+ if ( nodeStartPositionsAreOnSameLine ( parent , nodes [ 0 ] ) ) {
734733 if ( spacesBetweenBraces ) {
735734 write ( " " ) ;
736735 }
@@ -741,7 +740,7 @@ module ts {
741740
742741 for ( let i = 0 , n = nodes . length ; i < n ; i ++ ) {
743742 if ( i ) {
744- if ( preserveNewLines && nodeEndIsOnSameLineAsNodeStart ( nodes [ i - 1 ] , nodes [ i ] ) ) {
743+ if ( nodeEndIsOnSameLineAsNodeStart ( nodes [ i - 1 ] , nodes [ i ] ) ) {
745744 write ( ", " ) ;
746745 }
747746 else {
@@ -759,7 +758,7 @@ module ts {
759758
760759 decreaseIndent ( ) ;
761760
762- if ( preserveNewLines && nodeEndPositionsAreOnSameLine ( parent , lastOrUndefined ( nodes ) ) ) {
761+ if ( nodeEndPositionsAreOnSameLine ( parent , lastOrUndefined ( nodes ) ) ) {
763762 if ( spacesBetweenBraces ) {
764763 write ( " " ) ;
765764 }
@@ -1658,7 +1657,7 @@ module ts {
16581657 // If the code is not indented, an optional valueToWriteWhenNotIndenting will be
16591658 // emitted instead.
16601659 function indentIfOnDifferentLines ( parent : Node , node1 : Node , node2 : Node , valueToWriteWhenNotIndenting ?: string ) : boolean {
1661- let realNodesAreOnDifferentLines = preserveNewLines && ! nodeIsSynthesized ( parent ) && ! nodeEndIsOnSameLineAsNodeStart ( node1 , node2 ) ;
1660+ let realNodesAreOnDifferentLines = ! nodeIsSynthesized ( parent ) && ! nodeEndIsOnSameLineAsNodeStart ( node1 , node2 ) ;
16621661
16631662 // Always use a newline for synthesized code if the synthesizer desires it.
16641663 let synthesizedNodeIsOnDifferentLine = synthesizedNodeStartsOnNewLine ( node2 ) ;
@@ -1966,7 +1965,7 @@ module ts {
19661965 }
19671966
19681967 function emitBlock ( node : Block ) {
1969- if ( preserveNewLines && isSingleLineEmptyBlock ( node ) ) {
1968+ if ( isSingleLineEmptyBlock ( node ) ) {
19701969 emitToken ( SyntaxKind . OpenBraceToken , node . pos ) ;
19711970 write ( " " ) ;
19721971 emitToken ( SyntaxKind . CloseBraceToken , node . statements . end ) ;
@@ -2168,8 +2167,6 @@ module ts {
21682167 let counter = createTempVariable ( TempFlags . _i ) ;
21692168 let rhsReference = rhsIsIdentifier ? < Identifier > node . expression : createTempVariable ( TempFlags . Auto ) ;
21702169
2171- var cachedLength = compilerOptions . cacheDownlevelForOfLength ? createTempVariable ( TempFlags . _n ) : undefined ;
2172-
21732170 // This is the let keyword for the counter and rhsReference. The let keyword for
21742171 // the LHS will be emitted inside the body.
21752172 emitStart ( node . expression ) ;
@@ -2190,28 +2187,15 @@ module ts {
21902187 emitEnd ( node . expression ) ;
21912188 }
21922189
2193- if ( cachedLength ) {
2194- write ( ", " ) ;
2195- emitNodeWithoutSourceMap ( cachedLength ) ;
2196- write ( " = " ) ;
2197- emitNodeWithoutSourceMap ( rhsReference ) ;
2198- write ( ".length" ) ;
2199- }
2200-
22012190 write ( "; " ) ;
22022191
22032192 // _i < _a.length;
22042193 emitStart ( node . initializer ) ;
22052194 emitNodeWithoutSourceMap ( counter ) ;
22062195 write ( " < " ) ;
22072196
2208- if ( cachedLength ) {
2209- emitNodeWithoutSourceMap ( cachedLength ) ;
2210- }
2211- else {
2212- emitNodeWithoutSourceMap ( rhsReference ) ;
2213- write ( ".length" ) ;
2214- }
2197+ emitNodeWithoutSourceMap ( rhsReference ) ;
2198+ write ( ".length" ) ;
22152199
22162200 emitEnd ( node . initializer ) ;
22172201 write ( "; " ) ;
@@ -2350,7 +2334,7 @@ module ts {
23502334 write ( "default:" ) ;
23512335 }
23522336
2353- if ( preserveNewLines && node . statements . length === 1 && nodeStartPositionsAreOnSameLine ( node , node . statements [ 0 ] ) ) {
2337+ if ( node . statements . length === 1 && nodeStartPositionsAreOnSameLine ( node , node . statements [ 0 ] ) ) {
23542338 write ( " " ) ;
23552339 emit ( node . statements [ 0 ] ) ;
23562340 }
@@ -3090,7 +3074,7 @@ module ts {
30903074
30913075 // If we didn't have to emit any preamble code, then attempt to keep the arrow
30923076 // function on one line.
3093- if ( preserveNewLines && ! preambleEmitted && nodeStartPositionsAreOnSameLine ( node , body ) ) {
3077+ if ( ! preambleEmitted && nodeStartPositionsAreOnSameLine ( node , body ) ) {
30943078 write ( " " ) ;
30953079 emitStart ( body ) ;
30963080 write ( "return " ) ;
@@ -3138,7 +3122,7 @@ module ts {
31383122
31393123 let preambleEmitted = writer . getTextPos ( ) !== initialTextPos ;
31403124
3141- if ( preserveNewLines && ! preambleEmitted && nodeEndIsOnSameLineAsNodeStart ( body , body ) ) {
3125+ if ( ! preambleEmitted && nodeEndIsOnSameLineAsNodeStart ( body , body ) ) {
31423126 for ( let statement of body . statements ) {
31433127 write ( " " ) ;
31443128 emit ( statement ) ;
0 commit comments