@@ -3580,24 +3580,31 @@ module ts {
3580
3580
return filter ( errors , e => ! e . file ) ;
3581
3581
}
3582
3582
3583
- function addExtension ( filename : string , extension : string ) : string {
3584
- return getBaseFilename ( filename ) . indexOf ( "." ) >= 0 ? filename : filename + extension ;
3583
+ function hasExtension ( filename : string ) : boolean {
3584
+ return getBaseFilename ( filename ) . indexOf ( "." ) >= 0 ;
3585
3585
}
3586
3586
3587
3587
function processRootFile ( filename : string , isDefaultLib : boolean ) {
3588
- processSourceFile ( normalizePath ( addExtension ( filename , ".ts" ) ) , isDefaultLib ) ;
3588
+ processSourceFile ( normalizePath ( filename ) , isDefaultLib ) ;
3589
3589
}
3590
3590
3591
3591
function processSourceFile ( filename : string , isDefaultLib : boolean , refFile ?: SourceFile , refPos ?: number , refEnd ?: number ) {
3592
3592
if ( refEnd !== undefined && refPos !== undefined ) {
3593
3593
var start = refPos ;
3594
3594
var length = refEnd - refPos ;
3595
3595
}
3596
- if ( ! fileExtensionIs ( filename , ".ts" ) ) {
3597
- errors . push ( createFileDiagnostic ( refFile , start , length , Diagnostics . File_0_must_have_extension_ts_or_d_ts , filename ) ) ;
3596
+ if ( hasExtension ( filename ) ) {
3597
+ if ( ! fileExtensionIs ( filename , ".ts" ) ) {
3598
+ errors . push ( createFileDiagnostic ( refFile , start , length , Diagnostics . File_0_must_have_extension_ts_or_d_ts , filename ) ) ;
3599
+ }
3600
+ else if ( ! findSourceFile ( filename , isDefaultLib , refFile , refPos , refEnd ) ) {
3601
+ errors . push ( createFileDiagnostic ( refFile , start , length , Diagnostics . File_0_not_found , filename ) ) ;
3602
+ }
3598
3603
}
3599
- else if ( ! findSourceFile ( filename , isDefaultLib , refFile , refPos , refEnd ) ) {
3600
- errors . push ( createFileDiagnostic ( refFile , start , length , Diagnostics . File_0_not_found , filename ) ) ;
3604
+ else {
3605
+ if ( ! ( findSourceFile ( filename + ".ts" , isDefaultLib , refFile , refPos , refEnd ) || findSourceFile ( filename + ".d.ts" , isDefaultLib , refFile , refPos , refEnd ) ) ) {
3606
+ errors . push ( createFileDiagnostic ( refFile , start , length , Diagnostics . File_0_not_found , filename + ".ts" ) ) ;
3607
+ }
3601
3608
}
3602
3609
}
3603
3610
0 commit comments