Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitee4e7cb

Browse files
dsymeKevinRansom
authored andcommitted
Document and cleanup est.fs
1 parent9f6a821 commitee4e7cb

File tree

4 files changed

+404
-308
lines changed

4 files changed

+404
-308
lines changed

‎src/fsharp/build.fs‎

Lines changed: 44 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -3767,19 +3767,25 @@ type TcImports(tcConfigP:TcConfigProvider, initialResolutions:TcAssemblyResoluti
37673767
tcGlobals<- Some g
37683768

37693769
#if EXTENSIONTYPING
3770-
memberprivatetcImports.InjectProvidedNamespaceOrTypeIntoEntity typeProviderEnvironment(tcConfig:TcConfig)m(entity:Entity)(injectedNamspace,remainingNamespace)provider(st:Tainted<ProvidedType>option)=
3770+
memberprivatetcImports.InjectProvidedNamespaceOrTypeIntoEntity
3771+
(typeProviderEnvironment,
3772+
tcConfig:TcConfig,
3773+
m,entity:Entity,
3774+
injectedNamspace,remainingNamespace,
3775+
provider,
3776+
st:Tainted<ProvidedType>option)=
37713777
match remainingNamespacewith
37723778
| next::rest->
37733779
// Inject the namespace entity
37743780
match entity.ModuleOrNamespaceType.ModulesAndNamespacesByDemangledName.TryFind(next)with
37753781
| Some childEntity->
3776-
tcImports.InjectProvidedNamespaceOrTypeIntoEntity typeProviderEnvironment tcConfig m childEntity(next::injectedNamspace,rest) provider st
3782+
tcImports.InjectProvidedNamespaceOrTypeIntoEntity(typeProviderEnvironment, tcConfig, m, childEntity,next::injectedNamspace,rest, provider, st)
37773783
| None->
37783784
// Build up the artificial namespace if there is not a real one.
37793785
letcpath= CompPath(ILScopeRef.Local, injectedNamspace|> List.rev|> List.map(fun n->(n,ModuleOrNamespaceKind.Namespace)))
37803786
letnewNamespace= NewModuleOrNamespace(Some cpath) taccessPublic(ident(next,rangeStartup)) XmlDoc.Empty[](notlazy(NewEmptyModuleOrNamespaceType Namespace))
37813787
entity.ModuleOrNamespaceType.AddModuleOrNamespaceByMutation(newNamespace)
3782-
tcImports.InjectProvidedNamespaceOrTypeIntoEntity typeProviderEnvironment tcConfig m newNamespace(next::injectedNamspace,rest) provider st
3788+
tcImports.InjectProvidedNamespaceOrTypeIntoEntity(typeProviderEnvironment, tcConfig, m, newNamespace,next::injectedNamspace,rest, provider, st)
37833789
|[]->
37843790
match stwith
37853791
| Some st->
@@ -3808,46 +3814,46 @@ type TcImports(tcConfigP:TcConfigProvider, initialResolutions:TcAssemblyResoluti
38083814

38093815
|_-> failwith"Unexpected representation in namespace entity referred to by a type provider"
38103816

3811-
membertcImports.ImportTypeProviderExtensions(tpApprovalsRef:ApprovalIO.TypeProviderApprovalStatus list ref,
3812-
displayPSTypeProviderSecurityDialogBlockingUI,
3813-
tcConfig:TcConfig,
3814-
fileNameOfRuntimeAssembly,
3815-
ilScopeRefOfRuntimeAssembly,
3816-
moduleAttributes:ILAttribute list,
3817-
mspec,
3818-
invalidateCcu:Event<_>,
3819-
m)=
3820-
3821-
lettypeProviderEnvironment:ExtensionTyping.ResolutionEnvironment=
3822-
{ resolutionFolder= tcConfig.implicitIncludeDir
3823-
outputFile= tcConfig.outputFile
3824-
showResolutionMessages= tcConfig.showExtensionTypeMessages
3825-
referencedAssemblies=[|for rin resolutions.GetAssemblyResolutions()-> r.resolvedPath|]
3826-
temporaryFolder= Path.GetTempPath()
3827-
}
3817+
membertcImports.ImportTypeProviderExtensions
3818+
(tpApprovals:ApprovalIO.TypeProviderApprovalStatus list,
3819+
displayPSTypeProviderSecurityDialogBlockingUI,
3820+
tcConfig:TcConfig,
3821+
fileNameOfRuntimeAssembly,
3822+
ilScopeRefOfRuntimeAssembly,
3823+
runtimeAssemblyAttributes:ILAttribute list,
3824+
entityToInjectInto,invalidateCcu:Event<_>,m)=
3825+
3826+
letstartingErrorCount= CompileThreadStatic.ErrorLogger.ErrorCount
38283827

38293828
// Find assembly level TypeProviderAssemblyAttributes. These will point to the assemblies that
38303829
// have class which implement ITypeProvider and which have TypeProviderAttribute on them.
3831-
letstartingErrorCount= CompileThreadStatic.ErrorLogger.ErrorCount
38323830
letproviderAssemblies=
3833-
moduleAttributes
3831+
runtimeAssemblyAttributes
38343832
|> List.choose(TryDecodeTypeProviderAssemblyAttr(defaultArg ilGlobalsOpt EcmaILGlobals))
38353833
// If no design-time assembly is specified, use the runtime assembly
38363834
|> List.map(functionnull-> Path.GetFileNameWithoutExtension fileNameOfRuntimeAssembly| s-> s)
38373835
|> Set.ofList
38383836

38393837
if providerAssemblies.Count>0then
38403838

3841-
letsystemRuntimeAssemblyVersion:System.Version=
3839+
// Find the SystemRuntimeAssemblyVersion value to report in the TypeProviderConfig.
3840+
letsystemRuntimeAssemblyVersion=
38423841
letprimaryAssemblyRef= tcConfig.PrimaryAssemblyDllReference()
38433842
letresolution= tcConfig.ResolveLibWithDirectories CcuLoadFailureAction.RaiseError primaryAssemblyRef|> Option.get
38443843
// MSDN: this method causes the file to be opened and closed, but the assembly is not added to this domain
38453844
letname= System.Reflection.AssemblyName.GetAssemblyName(resolution.resolvedPath)
38463845
name.Version
38473846

3847+
lettypeProviderEnvironment=
3848+
{ resolutionFolder= tcConfig.implicitIncludeDir
3849+
outputFile= tcConfig.outputFile
3850+
showResolutionMessages= tcConfig.showExtensionTypeMessages
3851+
referencedAssemblies=[|for rin resolutions.GetAssemblyResolutions()-> r.resolvedPath|]
3852+
temporaryFolder= Path.GetTempPath()}
3853+
38483854
letproviders=
38493855
[for assemblyNamein providerAssembliesdo
3850-
yield ExtensionTyping.GetTypeProvidersOfAssembly(displayPSTypeProviderSecurityDialogBlockingUI, tcConfig.validateTypeProviders,tpApprovalsRef,
3856+
yield ExtensionTyping.GetTypeProvidersOfAssembly(displayPSTypeProviderSecurityDialogBlockingUI, tcConfig.validateTypeProviders,tpApprovals,
38513857
fileNameOfRuntimeAssembly, ilScopeRefOfRuntimeAssembly, assemblyName, typeProviderEnvironment,
38523858
tcConfig.isInvalidationSupported, tcConfig.isInteractive, tcImports.SystemRuntimeContainsType, systemRuntimeAssemblyVersion, m)]
38533859
letwasApproved= providers|> List.forall(fun(ok,_)-> ok)
@@ -3881,8 +3887,8 @@ type TcImports(tcConfigP:TcConfigProvider, initialResolutions:TcAssemblyResoluti
38813887
// Inject an entity for the namespace, or if one already exists, then record this as a provider
38823888
// for that namespace.
38833889
let recloop(providedNamespace:Tainted<IProvidedNamespace>)=
3884-
letpath= ExtensionTyping.GetPartsOfDotNetNamespace(m,provider,providedNamespace.PUntaint((fun r-> r.NamespaceName), m))
3885-
tcImports.InjectProvidedNamespaceOrTypeIntoEntitytypeProviderEnvironment tcConfig m mspec([],path) provider None
3890+
letpath= ExtensionTyping.GetProvidedNamespaceAsPath(m,provider,providedNamespace.PUntaint((fun r-> r.NamespaceName), m))
3891+
tcImports.InjectProvidedNamespaceOrTypeIntoEntity(typeProviderEnvironment, tcConfig, m, entityToInjectInto,[],path, provider, None)
38863892

38873893
// Inject entities for the types returned by provider.GetTypes().
38883894
//
@@ -3892,7 +3898,7 @@ type TcImports(tcConfigP:TcConfigProvider, initialResolutions:TcAssemblyResoluti
38923898
lettys= providedNamespace.PApplyArray((fun provider-> provider.GetTypes()),"GetTypes", m)
38933899
letptys=[|for tyin tys-> ty.PApply((fun ty-> ty|> ProvidedType.CreateNoContext), m)|]
38943900
for stin ptysdo
3895-
tcImports.InjectProvidedNamespaceOrTypeIntoEntity typeProviderEnvironment tcConfig m mspec([],path) provider(Some st)
3901+
tcImports.InjectProvidedNamespaceOrTypeIntoEntity(typeProviderEnvironment, tcConfig, m, entityToInjectInto,[],path, provider,Some st)
38963902

38973903
for providedNestedNamespacein providedNamespace.PApplyArray((fun provider-> provider.GetNestedNamespaces()),"GetNestedNamespaces", m)do
38983904
loop providedNestedNamespace
@@ -3923,7 +3929,7 @@ type TcImports(tcConfigP:TcConfigProvider, initialResolutions:TcAssemblyResoluti
39233929
// Compact Framework binaries must use this. However it is not
39243930
// clear when else it is required, e.g. for Mono.
39253931

3926-
membertcImports.PrepareToImportReferencedIlDlltpApprovalsRef m filename displayPSTypeProviderSecurityDialogBlockingUI(dllinfo:ImportedBinary)=
3932+
membertcImports.PrepareToImportReferencedIlDlltpApprovals m filename displayPSTypeProviderSecurityDialogBlockingUI(dllinfo:ImportedBinary)=
39273933
CheckDisposed()
39283934
lettcConfig= tcConfigP.Get()
39293935
tcConfig.CheckFSharpBinary(filename,dllinfo.ILAssemblyRefs,m)
@@ -3955,12 +3961,12 @@ type TcImports(tcConfigP:TcConfigProvider, initialResolutions:TcAssemblyResoluti
39553961
tcImports.RegisterCcu(ccuinfo);
39563962
letphase2()=
39573963
#if EXTENSIONTYPING
3958-
ccuinfo.TypeProviders<- tcImports.ImportTypeProviderExtensions(tpApprovalsRef, displayPSTypeProviderSecurityDialogBlockingUI, tcConfig, filename, ilScopeRef, ilModule.ManifestOfAssembly.CustomAttrs.AsList, ccu.Contents, invalidateCcu, m)
3964+
ccuinfo.TypeProviders<- tcImports.ImportTypeProviderExtensions(tpApprovals, displayPSTypeProviderSecurityDialogBlockingUI, tcConfig, filename, ilScopeRef, ilModule.ManifestOfAssembly.CustomAttrs.AsList, ccu.Contents, invalidateCcu, m)
39593965
#endif
39603966
[ResolvedImportedAssembly(ccuinfo)]
39613967
phase2
39623968

3963-
membertcImports.PrepareToImportReferencedFSharpDlltpApprovalsRef m filename displayPSTypeProviderSecurityDialogBlockingUI(dllinfo:ImportedBinary)=
3969+
membertcImports.PrepareToImportReferencedFSharpDlltpApprovals m filename displayPSTypeProviderSecurityDialogBlockingUI(dllinfo:ImportedBinary)=
39643970
CheckDisposed()
39653971
lettcConfig= tcConfigP.Get()
39663972
tcConfig.CheckFSharpBinary(filename,dllinfo.ILAssemblyRefs,m)
@@ -4080,7 +4086,7 @@ type TcImports(tcConfigP:TcConfigProvider, initialResolutions:TcAssemblyResoluti
40804086
ILScopeRef= ilScopeRef}
40814087
letphase2()=
40824088
#if EXTENSIONTYPING
4083-
ccuinfo.TypeProviders<- tcImports.ImportTypeProviderExtensions(tpApprovalsRef, displayPSTypeProviderSecurityDialogBlockingUI, tcConfig, filename, ilScopeRef, ilModule.ManifestOfAssembly.CustomAttrs.AsList, ccu.Contents, invalidateCcu, m)
4089+
ccuinfo.TypeProviders<- tcImports.ImportTypeProviderExtensions(tpApprovals, displayPSTypeProviderSecurityDialogBlockingUI, tcConfig, filename, ilScopeRef, ilModule.ManifestOfAssembly.CustomAttrs.AsList, ccu.Contents, invalidateCcu, m)
40844090
#else
40854091
()
40864092
#endif
@@ -4099,7 +4105,7 @@ type TcImports(tcConfigP:TcConfigProvider, initialResolutions:TcAssemblyResoluti
40994105
phase2
41004106

41014107

4102-
membertcImports.RegisterAndPrepareToImportReferencedDlltpApprovalsRef displayPSTypeProviderSecurityDialogBlockingUI(r:AssemblyResolution):_*(unit-> AvailableImportedAssembly list)=
4108+
membertcImports.RegisterAndPrepareToImportReferencedDlltpApprovals displayPSTypeProviderSecurityDialogBlockingUI(r:AssemblyResolution):_*(unit-> AvailableImportedAssembly list)=
41034109
CheckDisposed()
41044110
letm= r.originalReference.Range
41054111
letfilename= r.resolvedPath
@@ -4128,28 +4134,28 @@ type TcImports(tcConfigP:TcConfigProvider, initialResolutions:TcAssemblyResoluti
41284134
if(List.exists IsSignatureDataVersionAttr attrs)then
41294135
ifnot(List.exists(IsMatchingSignatureDataVersionAttr ilg(IL.parseILVersion Internal.Utilities.FSharpEnvironment.FSharpBinaryMetadataFormatRevision)) attrs)then
41304136
errorR(Error(FSComp.SR.buildDifferentVersionMustRecompile(filename),m))
4131-
tcImports.PrepareToImportReferencedIlDlltpApprovalsRef m filename displayPSTypeProviderSecurityDialogBlockingUI dllinfo
4137+
tcImports.PrepareToImportReferencedIlDlltpApprovals m filename displayPSTypeProviderSecurityDialogBlockingUI dllinfo
41324138
else
41334139
try
4134-
tcImports.PrepareToImportReferencedFSharpDlltpApprovalsRef m filename displayPSTypeProviderSecurityDialogBlockingUI dllinfo
4140+
tcImports.PrepareToImportReferencedFSharpDlltpApprovals m filename displayPSTypeProviderSecurityDialogBlockingUI dllinfo
41354141
with e-> error(Error(FSComp.SR.buildErrorOpeningBinaryFile(filename, e.Message),m))
41364142
else
4137-
tcImports.PrepareToImportReferencedIlDlltpApprovalsRef m filename displayPSTypeProviderSecurityDialogBlockingUI dllinfo
4143+
tcImports.PrepareToImportReferencedIlDlltpApprovals m filename displayPSTypeProviderSecurityDialogBlockingUI dllinfo
41384144
dllinfo,phase2
41394145

41404146
membertcImports.RegisterAndImportReferencedAssemblies(displayPSTypeProviderSecurityDialogBlockingUI,nms:AssemblyResolution list)=
41414147
CheckDisposed()
41424148

41434149
#if EXTENSIONTYPING
4144-
lettpApprovalsRef=ref(ExtensionTyping.ApprovalIO.readApprovalsFile(None))
4150+
lettpApprovals= ExtensionTyping.ApprovalIO.ReadApprovalsFile(None)
41454151
#else
4146-
lettpApprovalsRef=ref([])
4152+
lettpApprovals=[]
41474153
#endif
41484154
letdllinfos,phase2s=
41494155
nms|> List.map
41504156
(fun nm->
41514157
try
4152-
tcImports.RegisterAndPrepareToImportReferencedDlltpApprovalsRef displayPSTypeProviderSecurityDialogBlockingUI nm
4158+
tcImports.RegisterAndPrepareToImportReferencedDlltpApprovals displayPSTypeProviderSecurityDialogBlockingUI nm
41534159
with e->
41544160
error(Error(FSComp.SR.buildProblemReadingAssembly(nm.fusionName, e.Message),nm.originalReference.Range)))
41554161
|> List.unzip

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp