Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
dotNET Platform
fsharp
提交
36050db5
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,发现更多精彩内容 >>
提交
36050db5
编写于
8月 22, 2016
作者:
K
Kevin Ransom (msft)
提交者:
GitHub
8月 22, 2016
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1467 from forki/isNotNull
Cleanup isNotNull
上级
5b8bf72d
374bbc85
变更
14
隐藏空白更改
内联
并排
Showing
14 changed file
with
39 addition
and
13 deletion
+39
-13
src/fsharp/ErrorLogger.fs
src/fsharp/ErrorLogger.fs
+8
-2
src/fsharp/FSharp.Core.Unittests/SurfaceArea.coreclr.fs
src/fsharp/FSharp.Core.Unittests/SurfaceArea.coreclr.fs
+1
-0
src/fsharp/FSharp.Core.Unittests/SurfaceArea.net20.fs
src/fsharp/FSharp.Core.Unittests/SurfaceArea.net20.fs
+1
-0
src/fsharp/FSharp.Core.Unittests/SurfaceArea.net40.fs
src/fsharp/FSharp.Core.Unittests/SurfaceArea.net40.fs
+1
-0
src/fsharp/FSharp.Core.Unittests/SurfaceArea.portable259.fs
src/fsharp/FSharp.Core.Unittests/SurfaceArea.portable259.fs
+1
-0
src/fsharp/FSharp.Core.Unittests/SurfaceArea.portable47.fs
src/fsharp/FSharp.Core.Unittests/SurfaceArea.portable47.fs
+1
-0
src/fsharp/FSharp.Core.Unittests/SurfaceArea.portable7.fs
src/fsharp/FSharp.Core.Unittests/SurfaceArea.portable7.fs
+1
-0
src/fsharp/FSharp.Core.Unittests/SurfaceArea.portable78.fs
src/fsharp/FSharp.Core.Unittests/SurfaceArea.portable78.fs
+1
-0
src/fsharp/FSharp.Core/control.fs
src/fsharp/FSharp.Core/control.fs
+3
-3
src/fsharp/FSharp.Core/prim-types.fs
src/fsharp/FSharp.Core/prim-types.fs
+6
-0
src/fsharp/FSharp.Core/prim-types.fsi
src/fsharp/FSharp.Core/prim-types.fsi
+6
-0
src/fsharp/FSharp.Core/reflect.fs
src/fsharp/FSharp.Core/reflect.fs
+3
-3
src/utils/reshapedreflection.fs
src/utils/reshapedreflection.fs
+5
-4
src/utils/sformat.fs
src/utils/sformat.fs
+1
-1
未找到文件。
src/fsharp/ErrorLogger.fs
浏览文件 @
36050db5
...
...
@@ -270,11 +270,17 @@ type internal CompileThreadStatic =
static
member
BuildPhaseUnchecked
with
get
()
=
CompileThreadStatic
.
buildPhase
(* This can be a null value *)
static
member
BuildPhase
with
get
()
=
if
box
CompileThreadStatic
.
buildPhase
<>
null
then
CompileThreadStatic
.
buildPhase
else
(
assert
false
;
BuildPhase
.
DefaultPhase
)
with
get
()
=
match
box
CompileThreadStatic
.
buildPhase
with
|
null
->
assert
false
;
BuildPhase
.
DefaultPhase
|
_
->
CompileThreadStatic
.
buildPhase
and
set
v
=
CompileThreadStatic
.
buildPhase
<-
v
static
member
ErrorLogger
with
get
()
=
if
box
CompileThreadStatic
.
errorLogger
<>
null
then
CompileThreadStatic
.
errorLogger
else
!
uninitializedErrorLoggerFallback
with
get
()
=
match
box
CompileThreadStatic
.
errorLogger
with
|
null
->
!
uninitializedErrorLoggerFallback
|
_
->
CompileThreadStatic
.
errorLogger
and
set
v
=
CompileThreadStatic
.
errorLogger
<-
v
...
...
src/fsharp/FSharp.Core.Unittests/SurfaceArea.coreclr.fs
浏览文件 @
36050db5
...
...
@@ -2546,6 +2546,7 @@ Microsoft.FSharp.Core.Operators+Unchecked: System.Type GetType()
Microsoft.FSharp.Core.Operators+Unchecked: T DefaultOf[T]()
Microsoft.FSharp.Core.Operators+Unchecked: T Unbox[T](System.Object)
Microsoft.FSharp.Core.Operators: Boolean Equals(System.Object)
Microsoft.FSharp.Core.Operators: Boolean IsNotNull[T](T)
Microsoft.FSharp.Core.Operators: Boolean IsNull[T](T)
Microsoft.FSharp.Core.Operators: Boolean Not(Boolean)
Microsoft.FSharp.Core.Operators: Boolean op_Equality[T](T, T)
...
...
src/fsharp/FSharp.Core.Unittests/SurfaceArea.net20.fs
浏览文件 @
36050db5
...
...
@@ -2412,6 +2412,7 @@ Microsoft.FSharp.Core.Operators+Unchecked: System.Type GetType()
Microsoft.FSharp.Core.Operators+Unchecked: T DefaultOf[T]()
Microsoft.FSharp.Core.Operators+Unchecked: T Unbox[T](System.Object)
Microsoft.FSharp.Core.Operators: Boolean Equals(System.Object)
Microsoft.FSharp.Core.Operators: Boolean IsNotNull[T](T)
Microsoft.FSharp.Core.Operators: Boolean IsNull[T](T)
Microsoft.FSharp.Core.Operators: Boolean Not(Boolean)
Microsoft.FSharp.Core.Operators: Boolean op_Equality[T](T, T)
...
...
src/fsharp/FSharp.Core.Unittests/SurfaceArea.net40.fs
浏览文件 @
36050db5
...
...
@@ -2576,6 +2576,7 @@ Microsoft.FSharp.Core.Operators+Unchecked: System.Type GetType()
Microsoft.FSharp.Core.Operators+Unchecked: T DefaultOf[T]()
Microsoft.FSharp.Core.Operators+Unchecked: T Unbox[T](System.Object)
Microsoft.FSharp.Core.Operators: Boolean Equals(System.Object)
Microsoft.FSharp.Core.Operators: Boolean IsNotNull[T](T)
Microsoft.FSharp.Core.Operators: Boolean IsNull[T](T)
Microsoft.FSharp.Core.Operators: Boolean Not(Boolean)
Microsoft.FSharp.Core.Operators: Boolean op_Equality[T](T, T)
...
...
src/fsharp/FSharp.Core.Unittests/SurfaceArea.portable259.fs
浏览文件 @
36050db5
...
...
@@ -2551,6 +2551,7 @@ Microsoft.FSharp.Core.Operators+Unchecked: System.Type GetType()
Microsoft.FSharp.Core.Operators+Unchecked: T DefaultOf[T]()
Microsoft.FSharp.Core.Operators+Unchecked: T Unbox[T](System.Object)
Microsoft.FSharp.Core.Operators: Boolean Equals(System.Object)
Microsoft.FSharp.Core.Operators: Boolean IsNotNull[T](T)
Microsoft.FSharp.Core.Operators: Boolean IsNull[T](T)
Microsoft.FSharp.Core.Operators: Boolean Not(Boolean)
Microsoft.FSharp.Core.Operators: Boolean op_Equality[T](T, T)
...
...
src/fsharp/FSharp.Core.Unittests/SurfaceArea.portable47.fs
浏览文件 @
36050db5
...
...
@@ -2553,6 +2553,7 @@ Microsoft.FSharp.Core.Operators+Unchecked: System.Type GetType()
Microsoft.FSharp.Core.Operators+Unchecked: T DefaultOf[T]()
Microsoft.FSharp.Core.Operators+Unchecked: T Unbox[T](System.Object)
Microsoft.FSharp.Core.Operators: Boolean Equals(System.Object)
Microsoft.FSharp.Core.Operators: Boolean IsNotNull[T](T)
Microsoft.FSharp.Core.Operators: Boolean IsNull[T](T)
Microsoft.FSharp.Core.Operators: Boolean Not(Boolean)
Microsoft.FSharp.Core.Operators: Boolean op_Equality[T](T, T)
...
...
src/fsharp/FSharp.Core.Unittests/SurfaceArea.portable7.fs
浏览文件 @
36050db5
...
...
@@ -2564,6 +2564,7 @@ Microsoft.FSharp.Core.Operators+Unchecked: System.Type GetType()
Microsoft.FSharp.Core.Operators+Unchecked: T DefaultOf[T]()
Microsoft.FSharp.Core.Operators+Unchecked: T Unbox[T](System.Object)
Microsoft.FSharp.Core.Operators: Boolean Equals(System.Object)
Microsoft.FSharp.Core.Operators: Boolean IsNotNull[T](T)
Microsoft.FSharp.Core.Operators: Boolean IsNull[T](T)
Microsoft.FSharp.Core.Operators: Boolean Not(Boolean)
Microsoft.FSharp.Core.Operators: Boolean op_Equality[T](T, T)
...
...
src/fsharp/FSharp.Core.Unittests/SurfaceArea.portable78.fs
浏览文件 @
36050db5
...
...
@@ -2551,6 +2551,7 @@ Microsoft.FSharp.Core.Operators+Unchecked: System.Type GetType()
Microsoft.FSharp.Core.Operators+Unchecked: T DefaultOf[T]()
Microsoft.FSharp.Core.Operators+Unchecked: T Unbox[T](System.Object)
Microsoft.FSharp.Core.Operators: Boolean Equals(System.Object)
Microsoft.FSharp.Core.Operators: Boolean IsNotNull[T](T)
Microsoft.FSharp.Core.Operators: Boolean IsNull[T](T)
Microsoft.FSharp.Core.Operators: Boolean Not(Boolean)
Microsoft.FSharp.Core.Operators: Boolean op_Equality[T](T, T)
...
...
src/fsharp/FSharp.Core/control.fs
浏览文件 @
36050db5
...
...
@@ -2228,7 +2228,7 @@ namespace Microsoft.FSharp.Control
event
.
RemoveHandler
handle
if
args
.
Cancelled
then
ccont
(
new
OperationCanceledException
()
)
elif
args
.
Error
<>
null
then
elif
isNotNull
args
.
Error
then
econt
args
.
Error
else
cont
(
result
args
)
...
...
@@ -2515,8 +2515,8 @@ namespace Microsoft.FSharp.Control
|
Some
res
->
return
res
}
interface
System
.
IDisposable
with
member
x
.
Dispose
()
=
if
pulse
<>
null
then
(
pulse
:>
IDisposable
).
Dispose
()
member
__
.
Dispose
()
=
if
isNotNull
pulse
then
(
pulse
:>
IDisposable
).
Dispose
()
#
if
DEBUG
member
x
.
UnsafeContents
=
...
...
src/fsharp/FSharp.Core/prim-types.fs
浏览文件 @
36050db5
...
...
@@ -3804,6 +3804,12 @@ namespace Microsoft.FSharp.Core
|
null
->
true
|
_
->
false
[<
CompiledName
(
"IsNotNull"
)>]
let
inline
isNotNull
(
value
:
'
T
)
=
match
value
with
|
null
->
false
|
_
->
true
[<
CompiledName
(
"Raise"
)>]
let
raise
(
e
:
exn
)
=
(#
"throw"
e
:
'
T
#)
...
...
src/fsharp/FSharp.Core/prim-types.fsi
浏览文件 @
36050db5
...
...
@@ -2150,6 +2150,12 @@ namespace Microsoft.FSharp.Core
/// <returns>True when value is null, false otherwise.</returns>
[<
CompiledName
(
"IsNull"
)>]
val
inline
isNull
:
value
:
'
T
->
bool
when
'
T
:
null
/// <summary>Determines whether the given value is not null.</summary>
/// <param name="value">The value to check.</param>
/// <returns>True when value is not null, false otherwise.</returns>
[<
CompiledName
(
"IsNotNull"
)>]
val
inline
isNotNull
:
value
:
'
T
->
bool
when
'
T
:
null
/// <summary>Throw a <c>System.Exception</c> exception.</summary>
/// <param name="message">The exception message.</param>
...
...
src/fsharp/FSharp.Core/reflect.fs
浏览文件 @
36050db5
...
...
@@ -149,21 +149,21 @@ module internal Impl =
let
tryFindCompilationMappingAttributeFromType
(
typ
:
Type
)
=
let
assem
=
typ
.
Assembly
if
assem
<>
null
&&
assem
.
ReflectionOnly
then
if
isNotNull
assem
&&
assem
.
ReflectionOnly
then
tryFindCompilationMappingAttributeFromData
(
typ
.
GetCustomAttributesData
()
)
else
tryFindCompilationMappingAttribute
(
typ
.
GetCustomAttributes
(
typeof
<
CompilationMappingAttribute
>,
false
))
let
tryFindCompilationMappingAttributeFromMemberInfo
(
info
:
MemberInfo
)
=
let
assem
=
info
.
DeclaringType
.
Assembly
if
assem
<>
null
&&
assem
.
ReflectionOnly
then
if
isNotNull
assem
&&
assem
.
ReflectionOnly
then
tryFindCompilationMappingAttributeFromData
(
info
.
GetCustomAttributesData
()
)
else
tryFindCompilationMappingAttribute
(
info
.
GetCustomAttributes
(
typeof
<
CompilationMappingAttribute
>,
false
))
let
findCompilationMappingAttributeFromMemberInfo
(
info
:
MemberInfo
)
=
let
assem
=
info
.
DeclaringType
.
Assembly
if
assem
<>
null
&&
assem
.
ReflectionOnly
then
if
isNotNull
assem
&&
assem
.
ReflectionOnly
then
findCompilationMappingAttributeFromData
(
info
.
GetCustomAttributesData
()
)
else
findCompilationMappingAttribute
(
info
.
GetCustomAttributes
(
typeof
<
CompilationMappingAttribute
>,
false
))
...
...
src/utils/reshapedreflection.fs
浏览文件 @
36050db5
...
...
@@ -83,7 +83,7 @@ module internal ReflectionAdapters =
|
_
->
raise
(
AmbiguousMatchException
()
)
let
canUseAccessor
(
accessor
:
MethodInfo
)
nonPublic
=
box
accessor
<>
null
&&
(
accessor
.
IsPublic
||
nonPublic
)
isNotNull
(
box
accessor
)
&&
(
accessor
.
IsPublic
||
nonPublic
)
type
System
.
Type
with
member
this
.
GetTypeInfo
()
=
IntrospectionExtensions
.
GetTypeInfo
(
this
)
...
...
@@ -124,7 +124,7 @@ module internal ReflectionAdapters =
let
bindingFlags
=
defaultArg
bindingFlags
publicFlags
(
if
isDeclaredFlag
bindingFlags
then
this
.
GetTypeInfo
()
.
DeclaredProperties
else
this
.
GetRuntimeProperties
()
)
|>
Seq
.
filter
(
fun
pi
->
let
mi
=
if
pi
.
GetMethod
<>
null
then
pi
.
GetMethod
else
pi
.
S
etMethod
let
mi
=
match
pi
.
GetMethod
with
|
null
->
pi
.
SetMethod
|
_
->
pi
.
G
etMethod
if
mi
=
null
then
false
else
isAcceptable
bindingFlags
mi
.
IsStatic
mi
.
IsPublic
)
...
...
@@ -179,8 +179,9 @@ module internal ReflectionAdapters =
#
if
FX_RESHAPED_REFLECTION_CORECLR
member
this
.
InvokeMember
(
memberName
,
bindingFlags
,
_
binder
,
target
:
obj
,
arguments
:
obj
[]
,
_
cultureInfo
)
=
let
m
=
this
.
GetMethod
(
memberName
,
(
arguments
|>
Seq
.
map
(
fun
x
->
x
.
GetType
()
)
|>
Seq
.
toArray
),
bindingFlags
)
if
m
<>
null
then
m
.
Invoke
(
target
,
arguments
)
else
raise
<|
System
.
MissingMethodException
(
String
.
Format
(
"Method '{0}.{1}' not found."
,
this
.
FullName
,
memberName
))
match
m
with
|
null
->
raise
<|
System
.
MissingMethodException
(
String
.
Format
(
"Method '{0}.{1}' not found."
,
this
.
FullName
,
memberName
))
|
_
->
m
.
Invoke
(
target
,
arguments
)
#
endif
member
this
.
IsGenericType
=
this
.
GetTypeInfo
()
.
IsGenericType
member
this
.
IsGenericTypeDefinition
=
this
.
GetTypeInfo
()
.
IsGenericTypeDefinition
...
...
src/utils/sformat.fs
浏览文件 @
36050db5
...
...
@@ -713,7 +713,7 @@ namespace Microsoft.FSharp.Text.StructuredFormat
let
ty
=
obj
.
GetType
()
#
if
FX_ATLEAST_PORTABLE
let
prop
=
ty
.
GetProperty
(
name
,
(
BindingFlags
.
Instance
|||
BindingFlags
.
Public
|||
BindingFlags
.
NonPublic
))
if
prop
<>
null
then
prop
.
GetValue
(
obj
,[||])
if
isNotNull
prop
then
prop
.
GetValue
(
obj
,[||])
#
if
FX_NO_MISSINGMETHODEXCEPTION
// Profile 7, 47, 78 and 259 raise MissingMemberException
else
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录