@@ -192,7 +192,7 @@ namespace ts {
192192 export function nodePosToString ( node : Node ) : string {
193193 const file = getSourceFileOfNode ( node ) ;
194194 const loc = getLineAndCharacterOfPosition ( file , node . pos ) ;
195- return `${ file . fileName } (${ loc . line + 1 } ,${ loc . character + 1 } )` ;
195+ return `${ file . fileName } (${ loc . line + 1 } ,${ loc . character + 1 } )` ;
196196 }
197197
198198 export function getStartPosOfNode ( node : Node ) : number {
@@ -439,7 +439,7 @@ namespace ts {
439439 }
440440
441441 export function isBlockScope ( node : Node , parentNode : Node ) {
442- switch ( node . kind ) {
442+ switch ( node . kind ) {
443443 case SyntaxKind . SourceFile :
444444 case SyntaxKind . CaseBlock :
445445 case SyntaxKind . CatchClause :
@@ -644,9 +644,9 @@ namespace ts {
644644
645645 export function getJsDocCommentsFromText ( node : Node , text : string ) {
646646 const commentRanges = ( node . kind === SyntaxKind . Parameter ||
647- node . kind === SyntaxKind . TypeParameter ||
648- node . kind === SyntaxKind . FunctionExpression ||
649- node . kind === SyntaxKind . ArrowFunction ) ?
647+ node . kind === SyntaxKind . TypeParameter ||
648+ node . kind === SyntaxKind . FunctionExpression ||
649+ node . kind === SyntaxKind . ArrowFunction ) ?
650650 concatenate ( getTrailingCommentRanges ( text , node . pos ) , getLeadingCommentRanges ( text , node . pos ) ) :
651651 getLeadingCommentRangesOfNodeFromText ( node , text ) ;
652652 return filter ( commentRanges , isJsDocComment ) ;
@@ -911,7 +911,7 @@ namespace ts {
911911 export function isObjectLiteralOrClassExpressionMethod ( node : Node ) : node is MethodDeclaration {
912912 return node . kind === SyntaxKind . MethodDeclaration &&
913913 ( node . parent . kind === SyntaxKind . ObjectLiteralExpression ||
914- node . parent . kind === SyntaxKind . ClassExpression ) ;
914+ node . parent . kind === SyntaxKind . ClassExpression ) ;
915915 }
916916
917917 export function isIdentifierTypePredicate ( predicate : TypePredicate ) : predicate is IdentifierTypePredicate {
@@ -1133,8 +1133,8 @@ namespace ts {
11331133 // if the parameter's parent has a body and its grandparent is a class declaration, this is a valid target;
11341134 return ( < FunctionLikeDeclaration > node . parent ) . body !== undefined
11351135 && ( node . parent . kind === SyntaxKind . Constructor
1136- || node . parent . kind === SyntaxKind . MethodDeclaration
1137- || node . parent . kind === SyntaxKind . SetAccessor )
1136+ || node . parent . kind === SyntaxKind . MethodDeclaration
1137+ || node . parent . kind === SyntaxKind . SetAccessor )
11381138 && node . parent . parent . kind === SyntaxKind . ClassDeclaration ;
11391139 }
11401140
@@ -1481,7 +1481,7 @@ namespace ts {
14811481 } , tags => tags ) ;
14821482 }
14831483
1484- function getJSDocs < T > ( node : Node , checkParentVariableStatement : boolean , getDocs : ( docs : JSDoc [ ] ) => T [ ] , getTags : ( tags : JSDocTag [ ] ) => T [ ] ) : T [ ] {
1484+ function getJSDocs < T > ( node : Node , checkParentVariableStatement : boolean , getDocs : ( docs : JSDoc [ ] ) => T [ ] , getTags : ( tags : JSDocTag [ ] ) => T [ ] ) : T [ ] {
14851485 // TODO: Get rid of getJsDocComments and friends (note the lowercase 's' in Js)
14861486 // TODO: A lot of this work should be cached, maybe. I guess it's only used in services right now...
14871487 let result : T [ ] = undefined ;
@@ -1502,8 +1502,8 @@ namespace ts {
15021502
15031503 const variableStatementNode =
15041504 isInitializerOfVariableDeclarationInStatement ? node . parent . parent . parent :
1505- isVariableOfVariableDeclarationStatement ? node . parent . parent :
1506- undefined ;
1505+ isVariableOfVariableDeclarationStatement ? node . parent . parent :
1506+ undefined ;
15071507 if ( variableStatementNode ) {
15081508 result = append ( result , getJSDocs ( variableStatementNode , checkParentVariableStatement , getDocs , getTags ) ) ;
15091509 }
@@ -1668,7 +1668,7 @@ namespace ts {
16681668 if ( ( < ShorthandPropertyAssignment > parent ) . name !== node ) {
16691669 return AssignmentKind . None ;
16701670 }
1671- // Fall through
1671+ // Fall through
16721672 case SyntaxKind . PropertyAssignment :
16731673 node = parent . parent ;
16741674 break ;
@@ -2570,14 +2570,18 @@ namespace ts {
25702570 if ( options . outFile || options . out ) {
25712571 const moduleKind = getEmitModuleKind ( options ) ;
25722572 const moduleEmitEnabled = moduleKind === ModuleKind . AMD || moduleKind === ModuleKind . System ;
2573- const sourceFiles = host . getSourceFiles ( ) ;
2573+ const sourceFiles = getAllEmittableSourceFiles ( ) ;
25742574 // Can emit only sources that are not declaration file and are either non module code or module with --module or --target es6 specified
25752575 return filter ( sourceFiles , moduleEmitEnabled ? isNonDeclarationFile : isBundleEmitNonExternalModule ) ;
25762576 }
25772577 else {
2578- const sourceFiles = targetSourceFile === undefined ? host . getSourceFiles ( ) : [ targetSourceFile ] ;
2578+ const sourceFiles = targetSourceFile === undefined ? getAllEmittableSourceFiles ( ) : [ targetSourceFile ] ;
25792579 return filter ( sourceFiles , isNonDeclarationFile ) ;
25802580 }
2581+
2582+ function getAllEmittableSourceFiles ( ) {
2583+ return options . noEmitForJsFiles ? filter ( host . getSourceFiles ( ) , sourceFile => ! isSourceFileJavaScript ( sourceFile ) ) : host . getSourceFiles ( ) ;
2584+ }
25812585 }
25822586
25832587 function isNonDeclarationFile ( sourceFile : SourceFile ) {
@@ -2609,7 +2613,7 @@ namespace ts {
26092613 }
26102614 else {
26112615 for ( const sourceFile of sourceFiles ) {
2612- // Don't emit if source file is a declaration file, or was located under node_modules
2616+ // Don't emit if source file is a declaration file, or was located under node_modules
26132617 if ( ! isDeclarationFile ( sourceFile ) && ! host . isSourceFileFromExternalLibrary ( sourceFile ) ) {
26142618 onSingleFileEmit ( host , sourceFile ) ;
26152619 }
@@ -2671,7 +2675,7 @@ namespace ts {
26712675 onBundledEmit ( host ) ;
26722676 }
26732677 else {
2674- const sourceFiles = targetSourceFile === undefined ? host . getSourceFiles ( ) : [ targetSourceFile ] ;
2678+ const sourceFiles = targetSourceFile === undefined ? getSourceFilesToEmit ( host ) : [ targetSourceFile ] ;
26752679 for ( const sourceFile of sourceFiles ) {
26762680 // Don't emit if source file is a declaration file, or was located under node_modules
26772681 if ( ! isDeclarationFile ( sourceFile ) && ! host . isSourceFileFromExternalLibrary ( sourceFile ) ) {
@@ -2709,11 +2713,11 @@ namespace ts {
27092713 function onBundledEmit ( host : EmitHost ) {
27102714 // Can emit only sources that are not declaration file and are either non module code or module with
27112715 // --module or --target es6 specified. Files included by searching under node_modules are also not emitted.
2712- const bundledSources = filter ( host . getSourceFiles ( ) ,
2716+ const bundledSources = filter ( getSourceFilesToEmit ( host ) ,
27132717 sourceFile => ! isDeclarationFile ( sourceFile ) &&
2714- ! host . isSourceFileFromExternalLibrary ( sourceFile ) &&
2715- ( ! isExternalModule ( sourceFile ) ||
2716- ! ! getEmitModuleKind ( options ) ) ) ;
2718+ ! host . isSourceFileFromExternalLibrary ( sourceFile ) &&
2719+ ( ! isExternalModule ( sourceFile ) ||
2720+ ! ! getEmitModuleKind ( options ) ) ) ;
27172721 if ( bundledSources . length ) {
27182722 const jsFilePath = options . outFile || options . out ;
27192723 const emitFileNames : EmitFileNames = {
@@ -2899,7 +2903,7 @@ namespace ts {
28992903 writeComment : ( text : string , lineMap : number [ ] , writer : EmitTextWriter , commentPos : number , commentEnd : number , newLine : string ) => void ,
29002904 node : TextRange , newLine : string , removeComments : boolean ) {
29012905 let leadingComments : CommentRange [ ] ;
2902- let currentDetachedCommentInfo : { nodePos : number , detachedCommentEndPos : number } ;
2906+ let currentDetachedCommentInfo : { nodePos : number , detachedCommentEndPos : number } ;
29032907 if ( removeComments ) {
29042908 // removeComments is true, only reserve pinned comment at the top of file
29052909 // For example:
@@ -3246,10 +3250,10 @@ namespace ts {
32463250
32473251 function stringifyValue ( value : any ) : string {
32483252 return typeof value === "string" ? `"${ escapeString ( value ) } "`
3249- : typeof value === "number" ? isFinite ( value ) ? String ( value ) : "null"
3250- : typeof value === "boolean" ? value ? "true" : "false"
3251- : typeof value === "object" && value ? isArray ( value ) ? cycleCheck ( stringifyArray , value ) : cycleCheck ( stringifyObject , value )
3252- : /*fallback*/ "null" ;
3253+ : typeof value === "number" ? isFinite ( value ) ? String ( value ) : "null"
3254+ : typeof value === "boolean" ? value ? "true" : "false"
3255+ : typeof value === "object" && value ? isArray ( value ) ? cycleCheck ( stringifyArray , value ) : cycleCheck ( stringifyObject , value )
3256+ : /*fallback*/ "null" ;
32533257 }
32543258
32553259 function cycleCheck ( cb : ( value : any ) => string , value : any ) {
@@ -3274,7 +3278,7 @@ namespace ts {
32743278
32753279 function stringifyProperty ( memo : string , value : any , key : string ) {
32763280 return value === undefined || typeof value === "function" || key === "__cycle" ? memo
3277- : ( memo ? memo + "," : memo ) + `"${ escapeString ( key ) } ":${ stringifyValue ( value ) } ` ;
3281+ : ( memo ? memo + "," : memo ) + `"${ escapeString ( key ) } ":${ stringifyValue ( value ) } ` ;
32783282 }
32793283
32803284 const base64Digits = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=" ;
@@ -3519,7 +3523,7 @@ namespace ts {
35193523 * @param token The token.
35203524 */
35213525 export function createTokenRange ( pos : number , token : SyntaxKind ) : TextRange {
3522- return createRange ( pos , pos + tokenToString ( token ) . length ) ;
3526+ return createRange ( pos , pos + tokenToString ( token ) . length ) ;
35233527 }
35243528
35253529 export function rangeIsOnSingleLine ( range : TextRange , sourceFile : SourceFile ) {
0 commit comments