@@ -569,15 +569,16 @@ namespace ts {
569
569
570
570
function getBuildOrderFor ( state : SolutionBuilderState , project : string | undefined , onlyReferences : boolean | undefined ) {
571
571
const resolvedProject = project && resolveProjectName ( state , project ) ;
572
+ const buildOrderFromState = getBuildOrder ( state ) ;
572
573
if ( resolvedProject ) {
573
574
const projectPath = toResolvedConfigFilePath ( state , resolvedProject ) ;
574
575
const projectIndex = findIndex (
575
- getBuildOrder ( state ) ,
576
+ buildOrderFromState ,
576
577
configFileName => toResolvedConfigFilePath ( state , configFileName ) === projectPath
577
578
) ;
578
579
if ( projectIndex === - 1 ) return undefined ;
579
580
}
580
- const buildOrder = resolvedProject ? createBuildOrder ( state , [ resolvedProject ] ) : getBuildOrder ( state ) ;
581
+ const buildOrder = resolvedProject ? createBuildOrder ( state , [ resolvedProject ] ) : buildOrderFromState ;
581
582
Debug . assert ( ! onlyReferences || resolvedProject !== undefined ) ;
582
583
Debug . assert ( ! onlyReferences || buildOrder [ buildOrder . length - 1 ] === resolvedProject ) ;
583
584
return onlyReferences ? buildOrder . slice ( 0 , buildOrder . length - 1 ) : buildOrder ;
@@ -1714,8 +1715,8 @@ namespace ts {
1714
1715
}
1715
1716
1716
1717
disableCache ( state ) ;
1717
- reportErrorSummary ( state ) ;
1718
- startWatching ( state ) ;
1718
+ reportErrorSummary ( state , buildOrder ) ;
1719
+ startWatching ( state , buildOrder ) ;
1719
1720
1720
1721
return errorProjects ?
1721
1722
successfulProjects ?
@@ -1798,7 +1799,8 @@ namespace ts {
1798
1799
state . projectErrorsReported . clear ( ) ;
1799
1800
reportWatchStatus ( state , Diagnostics . File_change_detected_Starting_incremental_compilation ) ;
1800
1801
}
1801
- const invalidatedProject = getNextInvalidatedProject ( state , getBuildOrder ( state ) , /*reportQueue*/ false ) ;
1802
+ const buildOrder = getBuildOrder ( state ) ;
1803
+ const invalidatedProject = getNextInvalidatedProject ( state , buildOrder , /*reportQueue*/ false ) ;
1802
1804
if ( invalidatedProject ) {
1803
1805
invalidatedProject . done ( ) ;
1804
1806
if ( state . projectPendingBuild . size ) {
@@ -1810,7 +1812,7 @@ namespace ts {
1810
1812
}
1811
1813
}
1812
1814
disableCache ( state ) ;
1813
- reportErrorSummary ( state ) ;
1815
+ reportErrorSummary ( state , buildOrder ) ;
1814
1816
}
1815
1817
1816
1818
function watchConfigFile ( state : SolutionBuilderState , resolved : ResolvedConfigFileName , resolvedPath : ResolvedConfigFilePath ) {
@@ -1908,10 +1910,10 @@ namespace ts {
1908
1910
) ;
1909
1911
}
1910
1912
1911
- function startWatching ( state : SolutionBuilderState ) {
1913
+ function startWatching ( state : SolutionBuilderState , buildOrder : readonly ResolvedConfigFileName [ ] ) {
1912
1914
if ( ! state . watchAllProjectsPending ) return ;
1913
1915
state . watchAllProjectsPending = false ;
1914
- for ( const resolved of getBuildOrder ( state ) ) {
1916
+ for ( const resolved of buildOrder ) {
1915
1917
const resolvedPath = toResolvedConfigFilePath ( state , resolved ) ;
1916
1918
// Watch this file
1917
1919
watchConfigFile ( state , resolved , resolvedPath ) ;
@@ -1985,12 +1987,12 @@ namespace ts {
1985
1987
reportAndStoreErrors ( state , proj , [ state . configFileCache . get ( proj ) as Diagnostic ] ) ;
1986
1988
}
1987
1989
1988
- function reportErrorSummary ( state : SolutionBuilderState ) {
1990
+ function reportErrorSummary ( state : SolutionBuilderState , buildOrder : readonly ResolvedConfigFileName [ ] ) {
1989
1991
if ( ! state . needsSummary || ( ! state . watch && ! state . host . reportErrorSummary ) ) return ;
1990
1992
state . needsSummary = false ;
1991
1993
const { diagnostics } = state ;
1992
1994
// Report errors from the other projects
1993
- getBuildOrder ( state ) . forEach ( project => {
1995
+ buildOrder . forEach ( project => {
1994
1996
const projectPath = toResolvedConfigFilePath ( state , project ) ;
1995
1997
if ( ! state . projectErrorsReported . has ( projectPath ) ) {
1996
1998
reportErrors ( state , diagnostics . get ( projectPath ) || emptyArray ) ;
0 commit comments