@@ -781,7 +781,7 @@ module Harness {
781781
782782 public reset ( ) { this . fileCollection = { } ; }
783783
784- public toArray ( ) : { fileName : string ; file : WriterAggregator ; } [ ] {
784+ public toArray ( ) : { fileName : string ; file : WriterAggregator ; } [ ] {
785785 var result : { fileName : string ; file : WriterAggregator ; } [ ] = [ ] ;
786786 for ( var p in this . fileCollection ) {
787787 if ( this . fileCollection . hasOwnProperty ( p ) ) {
@@ -944,6 +944,8 @@ module Harness {
944944
945945 var newLine = '\r\n' ;
946946
947+ var includeBuiltFiles : { unitName : string ; content : string } [ ] = [ ] ;
948+
947949 var useCaseSensitiveFileNames = ts . sys . useCaseSensitiveFileNames ;
948950 this . settings . forEach ( setting => {
949951 switch ( setting . flag . toLowerCase ( ) ) {
@@ -1061,18 +1063,19 @@ module Harness {
10611063 break ;
10621064
10631065 case 'includebuiltfile' :
1064- inputFiles . push ( { unitName : setting . value , content : normalizeLineEndings ( IO . readFile ( libFolder + setting . value ) , newLine ) } ) ;
1066+ let builtFileName = libFolder + setting . value ;
1067+ includeBuiltFiles . push ( { unitName : builtFileName , content : normalizeLineEndings ( IO . readFile ( builtFileName ) , newLine ) } ) ;
10651068 break ;
10661069
10671070 default :
10681071 throw new Error ( 'Unsupported compiler setting ' + setting . flag ) ;
10691072 }
10701073 } ) ;
1071-
1074+
10721075 var fileOutputs : GeneratedFile [ ] = [ ] ;
10731076
1074- var programFiles = inputFiles . map ( file => file . unitName ) ;
1075- var program = ts . createProgram ( programFiles , options , createCompilerHost ( inputFiles . concat ( otherFiles ) ,
1077+ var programFiles = inputFiles . concat ( includeBuiltFiles ) . map ( file => file . unitName ) ;
1078+ var program = ts . createProgram ( programFiles , options , createCompilerHost ( inputFiles . concat ( includeBuiltFiles ) . concat ( otherFiles ) ,
10761079 ( fn , contents , writeByteOrderMark ) => fileOutputs . push ( { fileName : fn , code : contents , writeByteOrderMark : writeByteOrderMark } ) ,
10771080 options . target , useCaseSensitiveFileNames , currentDirectory ) ) ;
10781081
@@ -1295,7 +1298,7 @@ module Harness {
12951298 } ) ;
12961299
12971300 var numLibraryDiagnostics = ts . countWhere ( diagnostics , diagnostic => {
1298- return diagnostic . fileName && isLibraryFile ( diagnostic . fileName ) ;
1301+ return diagnostic . fileName && ( isLibraryFile ( diagnostic . fileName ) || isBuiltFile ( diagnostic . fileName ) ) ;
12991302 } ) ;
13001303
13011304 var numTest262HarnessDiagnostics = ts . countWhere ( diagnostics , diagnostic => {
@@ -1698,6 +1701,10 @@ module Harness {
16981701 return ( Path . getFileName ( filePath ) === 'lib.d.ts' ) || ( Path . getFileName ( filePath ) === 'lib.core.d.ts' ) ;
16991702 }
17001703
1704+ export function isBuiltFile ( filePath : string ) : boolean {
1705+ return filePath . indexOf ( Harness . libFolder ) === 0 ;
1706+ }
1707+
17011708 export function getDefaultLibraryFile ( ) : { unitName : string , content : string } {
17021709 var libFile = Harness . userSpecifiedroot + Harness . libFolder + "/" + "lib.d.ts" ;
17031710 return {
0 commit comments