@@ -1066,6 +1066,7 @@ module internal IncrementalFSharpBuild =
1066
1066
tcConfig: TcConfig
1067
1067
tcEnvAtEndOfFile: TcEnv
1068
1068
tcResolutions: Nameres .TcResolutions list
1069
+ tcSymbolUses: Nameres .TcSymbolUses list
1069
1070
topAttribs: TopAttribs option
1070
1071
typedImplFiles: TypedImplFile list
1071
1072
tcErrors:( PhasedError * FSharpErrorSeverity ) list } // errors=true, warnings=false
@@ -1168,6 +1169,7 @@ module internal IncrementalFSharpBuild =
1168
1169
TcEnvAtEnd : TypeChecker .TcEnv
1169
1170
Errors : ( PhasedError * FSharpErrorSeverity ) list
1170
1171
TcResolutions: Nameres .TcResolutions list
1172
+ TcSymbolUses: Nameres .TcSymbolUses list
1171
1173
TimeStamp: System .DateTime }
1172
1174
1173
1175
let GetPartialCheckResults ( tcAcc : TypeCheckAccumulator , timestamp ) =
@@ -1178,13 +1180,14 @@ module internal IncrementalFSharpBuild =
1178
1180
TcEnvAtEnd = tcAcc.tcEnvAtEndOfFile
1179
1181
Errors = tcAcc.tcErrors
1180
1182
TcResolutions = tcAcc.tcResolutions
1183
+ TcSymbolUses = tcAcc.tcSymbolUses
1181
1184
TimeStamp = timestamp }
1182
1185
1183
1186
1184
1187
type IncrementalBuilder ( tcConfig : TcConfig , projectDirectory , outfile , assemblyName , niceNameGen : Ast.NiceNameGenerator , lexResourceManager ,
1185
- sourceFiles: string list , projectReferences: IProjectReference list, ensureReactive,
1186
- keepAssemblyContents: bool )
1187
- =
1188
+ sourceFiles, projectReferences: IProjectReference list, ensureReactive,
1189
+ keepAssemblyContents, keepAllBackgroundResolutions ) =
1190
+
1188
1191
let tcConfigP = TcConfigProvider.Constant( tcConfig)
1189
1192
let importsInvalidated = new Event< string>()
1190
1193
let fileParsed = new Event<_>()
@@ -1354,6 +1357,7 @@ module internal IncrementalFSharpBuild =
1354
1357
tcConfig= tcConfig
1355
1358
tcEnvAtEndOfFile= tcEnv0
1356
1359
tcResolutions=[]
1360
+ tcSymbolUses=[]
1357
1361
topAttribs= None
1358
1362
typedImplFiles=[]
1359
1363
tcErrors= errorLogger.GetErrors() }
@@ -1386,13 +1390,15 @@ module internal IncrementalFSharpBuild =
1386
1390
1387
1391
/// Only keep the typed interface files when doing a "full" build for fsc.exe, otherwise just throw them away
1388
1392
let typedImplFiles = if keepAssemblyContents then typedImplFiles else []
1389
- let tcResolution = sink.GetTcResolutions()
1393
+ let tcResolutions = if keepAllBackgroundResolutions then sink.GetResolutions() else Nameres.TcResolutions.Empty
1394
+ let tcSymbolUses = sink.GetSymbolUses()
1390
1395
fileChecked.Trigger filename
1391
1396
return { tcAcc with tcState= tcState
1392
1397
tcEnvAtEndOfFile= tcEnvAtEndOfFile
1393
1398
topAttribs= Some topAttribs
1394
1399
typedImplFiles= typedImplFiles
1395
- tcResolutions= tcAcc.tcResolutions @ [ tcResolution]
1400
+ tcResolutions= tcAcc.tcResolutions @ [ tcResolutions]
1401
+ tcSymbolUses= tcAcc.tcSymbolUses @ [ tcSymbolUses]
1396
1402
tcErrors = tcAcc.tcErrors @ parseErrors @ capturingErrorLogger.GetErrors() }
1397
1403
}
1398
1404
@@ -1709,7 +1715,7 @@ module internal IncrementalFSharpBuild =
1709
1715
1710
1716
/// CreateIncrementalBuilder (for background type checking). Note that fsc.fs also
1711
1717
/// creates an incremental builder used by the command line compiler.
1712
- static member TryCreateBackgroundBuilderForProjectOptions ( scriptClosureOptions : LoadClosure option , sourceFiles : string list , commandLineArgs : string list , projectReferences , projectDirectory , useScriptResolutionRules , isIncompleteTypeCheckEnvironment , keepAssemblyContents ) =
1718
+ static member TryCreateBackgroundBuilderForProjectOptions ( scriptClosureOptions : LoadClosure option , sourceFiles : string list , commandLineArgs : string list , projectReferences , projectDirectory , useScriptResolutionRules , isIncompleteTypeCheckEnvironment , keepAssemblyContents , keepAllBackgroundResolutions ) =
1713
1719
1714
1720
// Trap and report warnings and errors from creation.
1715
1721
use errorScope = new ErrorScope()
@@ -1788,7 +1794,8 @@ module internal IncrementalFSharpBuild =
1788
1794
let builder =
1789
1795
new IncrementalBuilder( tcConfig, projectDirectory, outfile, assemblyName, niceNameGen,
1790
1796
resourceManager, sourceFilesNew, projectReferences, ensureReactive= true ,
1791
- keepAssemblyContents= keepAssemblyContents)
1797
+ keepAssemblyContents= keepAssemblyContents,
1798
+ keepAllBackgroundResolutions= keepAllBackgroundResolutions)
1792
1799
Some builder
1793
1800
with e ->
1794
1801
errorRecoveryNoRange e
0 commit comments