Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
dotNET Platform
fsharp
提交
1235f569
F
fsharp
项目概览
dotNET Platform
/
fsharp
12 个月 前同步成功
通知
0
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
F
fsharp
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
1235f569
编写于
9月 28, 2020
作者:
D
Don Syme
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
reduce diff
上级
c9a011b8
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
18 addition
and
41 deletion
+18
-41
src/fsharp/CompileOps.fs
src/fsharp/CompileOps.fs
+13
-18
src/fsharp/CompileOps.fsi
src/fsharp/CompileOps.fsi
+1
-19
src/fsharp/FxResolver.fs
src/fsharp/FxResolver.fs
+2
-2
src/utils/CompilerLocationUtils.fs
src/utils/CompilerLocationUtils.fs
+2
-2
未找到文件。
src/fsharp/CompileOps.fs
浏览文件 @
1235f569
...
...
@@ -2858,7 +2858,7 @@ type TcConfig private (data: TcConfigBuilder, validate: bool) =
let
primaryAssemblyReference
,
primaryAssemblyExplicitFilenameOpt
=
computeKnownDllReference
(
data
.
primaryAssembly
.
Name
)
let
fslibReference
=
// Look for explicit FSharp.Core reference otherwise use version that was referenced by compiler
let
dllReference
,
fileNameOpt
=
computeKnownDllReference
fs
harpCoreLibraryName
let
dllReference
,
fileNameOpt
=
computeKnownDllReference
getFS
harpCoreLibraryName
match
fileNameOpt
with
|
Some
_
->
dllReference
|
None
->
AssemblyReference
(
range0
,
getDefaultFSharpCoreLocation
()
,
None
)
...
...
@@ -3024,7 +3024,7 @@ type TcConfig private (data: TcConfigBuilder, validate: bool) =
member
x
.
legacyReferenceResolver
=
data
.
legacyReferenceResolver
member
_.
Clone
ToBuilder
()
=
member
_.
Clone
OfOriginalBuilder
=
{
data
with
conditionalCompilationDefines
=
data
.
conditionalCompilationDefines
}
member
tcConfig
.
ComputeCanContainEntryPoint
(
sourceFiles
:
string
list
)
=
...
...
@@ -3922,7 +3922,7 @@ let WriteSignatureData (tcConfig: TcConfig, tcGlobals, exportRemapping, ccu: Ccu
let
mspec
=
ApplyExportRemappingToEntity
tcGlobals
exportRemapping
mspec
// For historical reasons, we use a different resource name for FSharp.Core, so older F# compilers
// don't complain when they see the resource.
let
rName
=
if
ccu
.
AssemblyName
=
fs
harpCoreLibraryName
then
FSharpSignatureDataResourceName2
else
FSharpSignatureDataResourceName
let
rName
=
if
ccu
.
AssemblyName
=
getFS
harpCoreLibraryName
then
FSharpSignatureDataResourceName2
else
FSharpSignatureDataResourceName
let
includeDir
=
if
String
.
IsNullOrEmpty
tcConfig
.
implicitIncludeDir
then
""
...
...
@@ -3942,7 +3942,7 @@ let GetOptimizationData (file, ilScopeRef, ilModule, byteReader) =
let
WriteOptimizationData
(
tcGlobals
,
file
,
inMem
,
ccu
:
CcuThunk
,
modulInfo
)
=
// For historical reasons, we use a different resource name for FSharp.Core, so older F# compilers
// don't complain when they see the resource.
let
rName
=
if
ccu
.
AssemblyName
=
fs
harpCoreLibraryName
then
FSharpOptimizationDataResourceName2
else
FSharpOptimizationDataResourceName
let
rName
=
if
ccu
.
AssemblyName
=
getFS
harpCoreLibraryName
then
FSharpOptimizationDataResourceName2
else
FSharpOptimizationDataResourceName
PickleToResource
inMem
file
tcGlobals
ccu
(
rName
+
ccu
.
AssemblyName
)
Optimizer
.
p_CcuOptimizationInfo
modulInfo
//----------------------------------------------------------------------------
...
...
@@ -3952,11 +3952,8 @@ type RawFSharpAssemblyDataBackedByFileOnDisk (ilModule: ILModuleDef, ilAssemblyR
let
externalSigAndOptData
=
[
"FSharp.Core"
]
interface
IRawFSharpAssemblyData
with
member
__.
GetAutoOpenAttributes
ilg
=
GetAutoOpenAttributes
ilg
ilModule
member
__.
GetInternalsVisibleToAttributes
ilg
=
GetInternalsVisibleToAttributes
ilg
ilModule
member
__.
TryGetILModuleDef
()
=
Some
ilModule
member
__.
GetRawFSharpSignatureData
(
m
,
ilShortAssemName
,
filename
)
=
let
resources
=
ilModule
.
Resources
.
AsList
let
sigDataReaders
=
...
...
@@ -3974,7 +3971,6 @@ type RawFSharpAssemblyDataBackedByFileOnDisk (ilModule: ILModuleDef, ilAssemblyR
else
sigDataReaders
sigDataReaders
member
__.
GetRawFSharpOptimizationData
(
m
,
ilShortAssemName
,
filename
)
=
let
optDataReaders
=
ilModule
.
Resources
.
AsList
...
...
@@ -3990,7 +3986,6 @@ type RawFSharpAssemblyDataBackedByFileOnDisk (ilModule: ILModuleDef, ilAssemblyR
else
optDataReaders
optDataReaders
member
__.
GetRawTypeForwarders
()
=
match
ilModule
.
Manifest
with
|
Some
manifest
->
manifest
.
ExportedTypes
...
...
@@ -5083,7 +5078,7 @@ and [<Sealed>] TcImports(tcConfigP: TcConfigProvider, initialResolutions: TcAsse
let
fslibCcu
=
if
tcConfig
.
compilingFslib
then
// When compiling FSharp.Core.dll, the fslibCcu reference to FSharp.Core.dll is a delayed ccu thunk fixed up during type checking
CcuThunk
.
CreateDelayed
fs
harpCoreLibraryName
CcuThunk
.
CreateDelayed
getFS
harpCoreLibraryName
else
let
fslibCcuInfo
=
let
coreLibraryReference
=
tcConfig
.
CoreLibraryDllReference
()
...
...
@@ -5095,7 +5090,7 @@ and [<Sealed>] TcImports(tcConfigP: TcConfigProvider, initialResolutions: TcAsse
// Are we using a "non-canonical" FSharp.Core?
match
tcAltResolutions
.
TryFindByOriginalReference
coreLibraryReference
with
|
Some
resolution
->
Some
resolution
|
_
->
tcResolutions
.
TryFindByOriginalReferenceText
(
fs
harpCoreLibraryName
)
// was the ".dll" elided?
|
_
->
tcResolutions
.
TryFindByOriginalReferenceText
(
getFS
harpCoreLibraryName
)
// was the ".dll" elided?
match
resolvedAssemblyRef
with
|
Some
coreLibraryResolution
->
...
...
@@ -5320,7 +5315,7 @@ let ProcessMetaCommandsFromInput
let
ApplyNoWarnsToTcConfig
(
tcConfig
:
TcConfig
,
inp
:
ParsedInput
,
pathOfMetaCommandSource
)
=
// Clone
let
tcConfigB
=
tcConfig
.
Clone
ToBuilder
()
let
tcConfigB
=
tcConfig
.
Clone
OfOriginalBuilder
let
addNoWarn
=
fun
()
(
m
,
s
)
->
tcConfigB
.
TurnWarningOff
(
m
,
s
)
let
addFramework
=
fun
()
(_
m
,
_
s
)
->
()
let
addReferenceDirective
=
fun
()
(_
m
,
_
s
,
_)
->
()
...
...
@@ -5332,7 +5327,7 @@ let ApplyNoWarnsToTcConfig (tcConfig: TcConfig, inp: ParsedInput, pathOfMetaComm
let
ApplyMetaCommandsFromInputToTcConfig
(
tcConfig
:
TcConfig
,
inp
:
ParsedInput
,
pathOfMetaCommandSource
,
dependencyProvider
)
=
// Clone
let
tcConfigB
=
tcConfig
.
Clone
ToBuilder
()
let
tcConfigB
=
tcConfig
.
Clone
OfOriginalBuilder
let
addNoWarn
()
_
=
()
let
addFramework
()
(
m
,
fx
)
=
tcConfigB
.
CheckExplicitFrameworkDirective
(
fx
,
m
)
let
addReferenceDirective
()
(
m
,
path
,
directive
)
=
tcConfigB
.
AddReferenceDirective
(
dependencyProvider
,
m
,
path
,
directive
)
...
...
@@ -5514,7 +5509,7 @@ module ScriptPreprocessClosure =
(
tcConfig
:
TcConfig
,
inp
:
ParsedInput
,
pathOfMetaCommandSource
,
dependencyProvider
)
=
let
tcConfigB
=
tcConfig
.
Clone
ToBuilder
()
let
tcConfigB
=
tcConfig
.
Clone
OfOriginalBuilder
let
mutable
nowarns
=
[]
let
addNoWarn
=
fun
()
(
m
,
s
)
->
nowarns
<-
(
s
,
m
)
::
nowarns
let
addFramework
=
fun
()
(
m
,
fx
)
->
tcConfigB
.
CheckExplicitFrameworkDirective
(
fx
,
m
)
...
...
@@ -5530,7 +5525,7 @@ module ScriptPreprocessClosure =
TcConfig
.
Create
(
tcConfigB
,
validate
=
false
),
nowarns
with
ReportedError
_
->
// Recover by using a default TcConfig.
let
tcConfigB
=
tcConfig
.
Clone
ToBuilder
()
let
tcConfigB
=
tcConfig
.
Clone
OfOriginalBuilder
TcConfig
.
Create
(
tcConfigB
,
validate
=
false
),
nowarns
let
FindClosureFiles
...
...
@@ -5583,7 +5578,7 @@ module ScriptPreprocessClosure =
packageReferences
.[
m
]
<-
[
for
script
in
result
.
SourceFiles
do
yield
!
File
.
ReadAllLines
script
]
if
not
(
Seq
.
isEmpty
result
.
Roots
)
then
let
tcConfigB
=
tcConfig
.
Clone
ToBuilder
()
let
tcConfigB
=
tcConfig
.
Clone
OfOriginalBuilder
for
folder
in
result
.
Roots
do
tcConfigB
.
AddIncludePath
(
m
,
folder
,
""
)
tcConfigB
.
packageManagerLines
<-
PackageManagerLine
.
SetLinesAsProcessed
packageManagerKey
tcConfigB
.
packageManagerLines
...
...
@@ -5601,7 +5596,7 @@ module ScriptPreprocessClosure =
errorR
(
Error
(
FSComp
.
SR
.
packageManagerError
(
line
),
m
))
// Resolution produced errors update packagerManagerLines entries to note these failure
// failed resolutions will no longer be considered
let
tcConfigB
=
tcConfig
.
Clone
ToBuilder
()
let
tcConfigB
=
tcConfig
.
Clone
OfOriginalBuilder
tcConfigB
.
packageManagerLines
<-
PackageManagerLine
.
RemoveUnprocessedLines
packageManagerKey
tcConfigB
.
packageManagerLines
tcConfig
<-
TcConfig
.
Create
(
tcConfigB
,
validate
=
false
)]
else
[]
...
...
@@ -6107,5 +6102,5 @@ let TypeCheckClosedInputSet (ctok, checkForErrors, tcConfig, tcImports, tcGlobal
tcState
,
topAttrs
,
declaredImpls
,
tcEnvAtEndOfLastFile
// Existing public APIs delegate to newer implementations
let
GetFSharpCoreLibraryName
()
=
fs
harpCoreLibraryName
let
GetFSharpCoreLibraryName
()
=
getFS
harpCoreLibraryName
src/fsharp/CompileOps.fsi
浏览文件 @
1235f569
...
...
@@ -58,6 +58,7 @@ val IsScript: string -> bool
/// File suffixes where #light is the default
val
FSharpLightSyntaxFileSuffixes
:
string
list
/// Get the name used for FSharp.Core
val
GetFSharpCoreLibraryName
:
unit
->
string
...
...
@@ -154,29 +155,20 @@ type IRawFSharpAssemblyData =
abstract
GetAutoOpenAttributes
:
ILGlobals
->
string
list
/// The raw list InternalsVisibleToAttribute attributes in the assembly
abstract
GetInternalsVisibleToAttributes
:
ILGlobals
->
string
list
/// The raw IL module definition in the assembly, if any. This is not present for cross-project references
/// in the language service
abstract
TryGetILModuleDef
:
unit
->
ILModuleDef
option
abstract
HasAnyFSharpSignatureDataAttribute
:
bool
abstract
HasMatchingFSharpSignatureDataAttribute
:
ILGlobals
->
bool
/// The raw F# signature data in the assembly, if any
abstract
GetRawFSharpSignatureData
:
range
*
ilShortAssemName
:
string
*
fileName
:
string
->
(
string
*
(
unit
->
ReadOnlyByteMemory
))
list
/// The raw F# optimization data in the assembly, if any
abstract
GetRawFSharpOptimizationData
:
range
*
ilShortAssemName
:
string
*
fileName
:
string
->
(
string
*
(
unit
->
ReadOnlyByteMemory
))
list
/// The table of type forwarders in the assembly
abstract
GetRawTypeForwarders
:
unit
->
ILExportedTypesAndForwarders
/// The identity of the module
abstract
ILScopeRef
:
ILScopeRef
abstract
ILAssemblyRefs
:
ILAssemblyRef
list
abstract
ShortAssemblyName
:
string
type
TimeStampCache
=
...
...
@@ -461,25 +453,15 @@ type TcConfigBuilder =
->
TcConfigBuilder
member
DecideNames
:
string
list
->
outfile
:
string
*
pdbfile
:
string
option
*
assemblyName
:
string
member
TurnWarningOff
:
range
*
string
->
unit
member
TurnWarningOn
:
range
*
string
->
unit
member
CheckExplicitFrameworkDirective
:
fx
:
TargetFrameworkForScripts
*
m
:
range
->
unit
member
AddIncludePath
:
range
*
string
*
string
->
unit
member
AddCompilerToolsByPath
:
string
->
unit
member
AddReferencedAssemblyByPath
:
range
*
string
->
unit
member
RemoveReferencedAssemblyByPath
:
range
*
string
->
unit
member
AddEmbeddedSourceFile
:
string
->
unit
member
AddEmbeddedResource
:
string
->
unit
member
AddPathMapping
:
oldPrefix
:
string
*
newPrefix
:
string
->
unit
static
member
SplitCommandLineResourceInfo
:
string
->
string
*
string
*
ILResourceAccess
...
...
src/fsharp/FxResolver.fs
浏览文件 @
1235f569
...
...
@@ -337,7 +337,7 @@ type FxResolver(_reduceMemoryUsage, _tryGetMetadataSnapshot, preInferredUseDotNe
yield
"System.Drawing"
yield
"System.Core"
yield
fs
harpCoreLibraryName
yield
getFS
harpCoreLibraryName
if
useFsiAuxLib
then
yield
fsiLibraryName
// always include a default reference to System.ValueTuple.dll in scripts and out-of-project sources
...
...
@@ -403,7 +403,7 @@ type FxResolver(_reduceMemoryUsage, _tryGetMetadataSnapshot, preInferredUseDotNe
yield
"mscorlib"
yield
"netstandard"
yield
"System.Runtime"
yield
fs
harpCoreLibraryName
yield
getFS
harpCoreLibraryName
yield
"System"
yield
"System.Xml"
...
...
src/utils/CompilerLocationUtils.fs
浏览文件 @
1235f569
...
...
@@ -345,7 +345,7 @@ module internal FSharpEnvironment =
let
getCompilerToolsDesignTimeAssemblyPaths
compilerToolPaths
=
searchToolPaths
None
compilerToolPaths
let
fs
harpCoreLibraryName
=
"FSharp.Core"
let
getFS
harpCoreLibraryName
=
"FSharp.Core"
let
fsiLibraryName
=
"FSharp.Compiler.Interactive.Settings"
let
getFSharpCompilerLocation
()
=
...
...
@@ -361,6 +361,6 @@ module internal FSharpEnvironment =
// Use the location of this dll
location
let
getDefaultFSharpCoreLocation
()
=
Path
.
Combine
(
getFSharpCompilerLocation
()
,
fs
harpCoreLibraryName
+
".dll"
)
let
getDefaultFSharpCoreLocation
()
=
Path
.
Combine
(
getFSharpCompilerLocation
()
,
getFS
harpCoreLibraryName
+
".dll"
)
let
getDefaultFsiLibraryLocation
()
=
Path
.
Combine
(
getFSharpCompilerLocation
()
,
fsiLibraryName
+
".dll"
)
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录