File tree Expand file tree Collapse file tree 2 files changed +6
-9
lines changed Expand file tree Collapse file tree 2 files changed +6
-9
lines changed Original file line number Diff line number Diff line change @@ -25,13 +25,6 @@ module ts {
25
25
return indentStrings [ 1 ] . length ;
26
26
}
27
27
28
- function isDeclarationFile ( sourceFile : SourceFile ) : boolean {
29
- if ( sourceFile . flags & NodeFlags . DeclarationFile ) {
30
- return true ;
31
- }
32
- return false ;
33
- }
34
-
35
28
export function shouldEmitToOwnFile ( sourceFile : SourceFile , compilerOptions : CompilerOptions ) : boolean {
36
29
if ( ! isDeclarationFile ( sourceFile ) ) {
37
30
if ( ( isExternalModule ( sourceFile ) || ! compilerOptions . out ) && ! fileExtensionIs ( sourceFile . filename , ".js" ) ) {
@@ -43,7 +36,7 @@ module ts {
43
36
}
44
37
45
38
export function isExternalModuleOrDeclarationFile ( sourceFile : SourceFile ) {
46
- return isExternalModule ( sourceFile ) || ( sourceFile . flags & NodeFlags . DeclarationFile ) !== 0 ;
39
+ return isExternalModule ( sourceFile ) || isDeclarationFile ( sourceFile ) ;
47
40
}
48
41
49
42
// targetSourceFile is when users only want one file in entire project to be emitted. This is used in compilerOnSave feature
Original file line number Diff line number Diff line change @@ -111,6 +111,10 @@ module ts {
111
111
return file . externalModuleIndicator !== undefined ;
112
112
}
113
113
114
+ export function isDeclarationFile ( file : SourceFile ) : boolean {
115
+ return ( file . flags & NodeFlags . DeclarationFile ) !== 0 ;
116
+ }
117
+
114
118
export function isPrologueDirective ( node : Node ) : boolean {
115
119
return node . kind === SyntaxKind . ExpressionStatement && ( < ExpressionStatement > node ) . expression . kind === SyntaxKind . StringLiteral ;
116
120
}
@@ -4125,7 +4129,7 @@ module ts {
4125
4129
}
4126
4130
}
4127
4131
}
4128
- else if ( node . kind === SyntaxKind . ModuleDeclaration && ( < ModuleDeclaration > node ) . name . kind === SyntaxKind . StringLiteral && ( node . flags & NodeFlags . Ambient || file . flags & NodeFlags . DeclarationFile ) ) {
4132
+ else if ( node . kind === SyntaxKind . ModuleDeclaration && ( < ModuleDeclaration > node ) . name . kind === SyntaxKind . StringLiteral && ( node . flags & NodeFlags . Ambient || isDeclarationFile ( file ) ) ) {
4129
4133
// TypeScript 1.0 spec (April 2014): 12.1.6
4130
4134
// An AmbientExternalModuleDeclaration declares an external module.
4131
4135
// This type of declaration is permitted only in the global module.
You can’t perform that action at this time.
0 commit comments