@@ -163,7 +163,8 @@ type TypeCheckInfo
163163 loadClosure: LoadClosure option,
164164 reactorOps: IReactorOperations,
165165 checkAlive: ( unit-> bool),
166- textSnapshotInfo: obj option) =
166+ textSnapshotInfo: obj option,
167+ implementationFiles: TypedImplFile list) =
167168
168169let textSnapshotInfo = defaultArg textSnapshotInfonull
169170let (| CNR |) ( cnr : CapturedNameResolution ) =
@@ -1356,6 +1357,8 @@ type TypeCheckInfo
13561357/// The assembly being analyzed
13571358member __.ThisCcu = thisCcu
13581359
1360+ member __.ImplementationFiles = implementationFiles
1361+
13591362override __.ToString () = " TypeCheckInfo(" + mainInputFileName+ " )"
13601363
13611364
@@ -1662,7 +1665,7 @@ module internal Parser =
16621665let errors = errHandler.CollectedDiagnostics
16631666
16641667match tcEnvAtEndOptwith
1665- | Some( tcEnvAtEnd, _ typedImplFiles , tcState) ->
1668+ | Some( tcEnvAtEnd, typedImplFiles , tcState) ->
16661669let scope =
16671670 TypeCheckInfo( tcConfig, tcGlobals,
16681671 tcState.PartialAssemblySignature,
@@ -1678,7 +1681,8 @@ module internal Parser =
16781681 loadClosure,
16791682 reactorOps,
16801683 checkAlive,
1681- textSnapshotInfo)
1684+ textSnapshotInfo,
1685+ typedImplFiles)
16821686return errors, TypeCheckAborted.No scope
16831687| None->
16841688return errors, TypeCheckAborted.Yes
@@ -1761,7 +1765,7 @@ type FSharpCheckProjectResults(projectFileName:string, keepAssemblyContents, err
17611765 FSharpAssemblySignature( tcGlobals, thisCcu, tcImports, topAttribs, ccuSig)
17621766
17631767member info.AssemblyContents =
1764- if not keepAssemblyContentsthen invalidOp" The 'keepAssemblyContents' flag must be set totru on the FSharpChecker in order to access the checked contents of assemblies"
1768+ if not keepAssemblyContentsthen invalidOp" The 'keepAssemblyContents' flag must be set totrue on the FSharpChecker in order to access the checked contents of assemblies"
17651769let ( tcGlobals , tcImports , thisCcu , _ccuSig , _tcSymbolUses , _topAttribs , _tcAssemblyData , _ilAssemRef , _ad , tcAssemblyExpr , _dependencyFiles ) = getDetails()
17661770let mimpls =
17671771match tcAssemblyExprwith
@@ -1817,7 +1821,7 @@ type FSharpCheckProjectResults(projectFileName:string, keepAssemblyContents, err
18171821//
18181822// There is an important property of all the objects returned by the methods of this type: they do not require
18191823// the corresponding background builder to be alive. That is, they are simply plain-old-data through pre-formatting of all result text.
1820- type FSharpCheckFileResults ( filename : string , errors : FSharpErrorInfo [], scopeOptX : TypeCheckInfo option , dependencyFiles : string list , builderX : IncrementalBuilder option , reactorOpsX : IReactorOperations ) =
1824+ type FSharpCheckFileResults ( filename : string , errors : FSharpErrorInfo [], scopeOptX : TypeCheckInfo option , dependencyFiles : string list , builderX : IncrementalBuilder option , reactorOpsX : IReactorOperations , keepAssemblyContents : bool ) =
18211825
18221826// This may be None initially, or may be set to None when the object is disposed or finalized
18231827let mutable details = match scopeOptXwith None-> None| Some scopeX-> Some( scopeX, builderX, reactorOpsX)
@@ -2002,6 +2006,12 @@ type FSharpCheckFileResults(filename: string, errors: FSharpErrorInfo[], scopeOp
20022006 RequireCompilationThread ctok
20032007 scope.IsRelativeNameResolvable( pos, plid, item))
20042008
2009+ member info.ImplementationFiles =
2010+ if not keepAssemblyContentsthen invalidOp" The 'keepAssemblyContents' flag must be set to true on the FSharpChecker in order to access the checked contents of assemblies"
2011+ scopeOptX
2012+ |> Option.map( fun scope ->
2013+ let cenv = Impl.cenv( scope.TcGlobals, scope.ThisCcu, scope.TcImports)
2014+ [ for mimplin scope.ImplementationFiles-> FSharpImplementationFileContents( cenv, mimpl)])
20052015
20062016override info.ToString () = " FSharpCheckFileResults(" + filename+ " )"
20072017
@@ -2326,7 +2336,7 @@ type BackgroundCompiler(legacyReferenceResolver, projectCacheSize, keepAssemblyC
23262336static let mutable foregroundTypeCheckCount = 0
23272337
23282338let MakeCheckFileResultsEmpty ( filename , creationErrors ) =
2329- FSharpCheckFileResults( filename, Array.ofList creationErrors, None, [], None, reactorOps)
2339+ FSharpCheckFileResults( filename, Array.ofList creationErrors, None, [], None, reactorOps, keepAssemblyContents )
23302340
23312341let MakeCheckFileResults ( filename , options : FSharpProjectOptions , builder , scope , dependencyFiles , creationErrors , parseErrors , tcErrors ) =
23322342let errors =
@@ -2337,7 +2347,7 @@ type BackgroundCompiler(legacyReferenceResolver, projectCacheSize, keepAssemblyC
23372347else
23382348yield ! tcErrors|]
23392349
2340- FSharpCheckFileResults( filename, errors, Some scope, dependencyFiles, Some builder, reactorOps)
2350+ FSharpCheckFileResults( filename, errors, Some scope, dependencyFiles, Some builder, reactorOps, keepAssemblyContents )
23412351
23422352let MakeCheckFileAnswer ( filename , tcFileResult , options : FSharpProjectOptions , builder , dependencyFiles , creationErrors , parseErrors , tcErrors ) =
23432353match tcFileResultwith
@@ -2624,7 +2634,8 @@ type BackgroundCompiler(legacyReferenceResolver, projectCacheSize, keepAssemblyC
26242634 List.last tcProj.TcResolutions,
26252635 List.last tcProj.TcSymbolUses,
26262636 tcProj.TcEnvAtEnd.NameEnv,
2627- loadClosure, reactorOps, ( fun () -> builder.IsAlive), None)
2637+ loadClosure, reactorOps, ( fun () -> builder.IsAlive), None,
2638+ tcProj.ImplementationFiles)
26282639let typedResults = MakeCheckFileResults( filename, options, builder, scope, tcProj.TcDependencyFiles, creationErrors, parseResults.Errors, tcErrors)
26292640return ( parseResults, typedResults)
26302641})
@@ -3144,7 +3155,7 @@ type FsiInteractiveChecker(legacyReferenceResolver, reactorOps: IReactorOperatio
31443155match tcFileResultwith
31453156| Parser.TypeCheckAborted.No scope->
31463157let errors = [| yield ! parseErrors; yield ! tcErrors|]
3147- let typeCheckResults = FSharpCheckFileResults( filename, errors, Some scope, dependencyFiles, None, reactorOps)
3158+ let typeCheckResults = FSharpCheckFileResults( filename, errors, Some scope, dependencyFiles, None, reactorOps, false )
31483159let projectResults = FSharpCheckProjectResults( filename, keepAssemblyContents, errors, Some( tcGlobals, tcImports, scope.ThisCcu, scope.CcuSig, [ scope.ScopeSymbolUses], None, None, mkSimpleAssRef" stdin" , tcState.TcEnvFromImpls.AccessRights, None, dependencyFiles), reactorOps)
31493160 parseResults, typeCheckResults, projectResults
31503161| _ ->