Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
73aa7924
R
roslyn
项目概览
lwm1986
/
roslyn
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
roslyn
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
73aa7924
编写于
8月 31, 2016
作者:
V
VSadov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
CR feedback on fix for #13486
上级
dc2df6b5
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
35 addition
and
29 deletion
+35
-29
src/Compilers/CSharp/Portable/Lowering/AsyncRewriter/AsyncExceptionHandlerRewriter.cs
...e/Lowering/AsyncRewriter/AsyncExceptionHandlerRewriter.cs
+2
-2
src/Compilers/CSharp/Portable/Lowering/AsyncRewriter/AwaitExpressionSpiller.cs
...Portable/Lowering/AsyncRewriter/AwaitExpressionSpiller.cs
+1
-1
src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_BinaryOperator.cs
...le/Lowering/LocalRewriter/LocalRewriter_BinaryOperator.cs
+11
-5
src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_CompoundAssignmentOperator.cs
...LocalRewriter/LocalRewriter_CompoundAssignmentOperator.cs
+2
-2
src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_ConditionalAccess.cs
...Lowering/LocalRewriter/LocalRewriter_ConditionalAccess.cs
+2
-2
src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_Conversion.cs
...rtable/Lowering/LocalRewriter/LocalRewriter_Conversion.cs
+1
-1
src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_Patterns.cs
...Portable/Lowering/LocalRewriter/LocalRewriter_Patterns.cs
+9
-9
src/Compilers/CSharp/Portable/Lowering/SyntheticBoundNodeFactory.cs
...ers/CSharp/Portable/Lowering/SyntheticBoundNodeFactory.cs
+7
-7
未找到文件。
src/Compilers/CSharp/Portable/Lowering/AsyncRewriter/AsyncExceptionHandlerRewriter.cs
浏览文件 @
73aa7924
...
...
@@ -572,10 +572,10 @@ public override BoundNode VisitCatchBlock(BoundCatchBlock node)
var
sourceOpt
=
node
.
ExceptionSourceOpt
;
var
rewrittenFilter
=
(
BoundExpression
)
this
.
Visit
(
filterOpt
);
var
newFilter
=
sourceOpt
==
null
?
_F
.
Sequence
(
_F
.
Make
Sequence
(
storePending
,
rewrittenFilter
)
:
_F
.
Sequence
(
_F
.
Make
Sequence
(
storePending
,
AssignCatchSource
((
BoundExpression
)
this
.
Visit
(
sourceOpt
),
currentAwaitCatchFrame
),
rewrittenFilter
);
...
...
src/Compilers/CSharp/Portable/Lowering/AsyncRewriter/AwaitExpressionSpiller.cs
浏览文件 @
73aa7924
...
...
@@ -965,7 +965,7 @@ public override BoundNode VisitLoweredConditionalAccess(BoundLoweredConditionalA
// isNotCalss || {clone = receiver; (object)clone != null}
condition
=
_F
.
LogicalOr
(
isNotClass
,
_F
.
Sequence
(
_F
.
Make
Sequence
(
_F
.
AssignmentExpression
(
_F
.
Local
(
clone
),
receiver
),
_F
.
ObjectNotEqual
(
_F
.
Convert
(
_F
.
SpecialType
(
SpecialType
.
System_Object
),
_F
.
Local
(
clone
)),
...
...
src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_BinaryOperator.cs
浏览文件 @
73aa7924
...
...
@@ -266,13 +266,19 @@ public BoundExpression VisitBinaryOperator(BoundBinaryOperator node, BoundUnaryO
if
(
loweredRight
.
ConstantValue
==
ConstantValue
.
True
)
return
loweredLeft
;
if
(
loweredLeft
.
ConstantValue
==
ConstantValue
.
True
)
return
loweredRight
;
// note that we are using IsDefaultValue instead of False.
// that is just to catch cases like default(bool) ot others resulting in
// a default bool value, that we know to be "false"
// bool? generally should not reach here, since it is handled by RewriteLiftedBinaryOperator
// regardless, the following code shoudl handle default(bool?) correctly since
// default(bool?) & <expr> == default(bool?) with sideeffects of <expr>
if
(
loweredLeft
.
IsDefaultValue
())
{
return
_factory
.
Sequence
(
loweredRight
,
loweredLeft
);
return
_factory
.
Make
Sequence
(
loweredRight
,
loweredLeft
);
}
if
(
loweredRight
.
IsDefaultValue
())
{
return
_factory
.
Sequence
(
loweredLeft
,
loweredRight
);
return
_factory
.
Make
Sequence
(
loweredLeft
,
loweredRight
);
}
goto
default
;
...
...
@@ -400,11 +406,11 @@ public BoundExpression VisitBinaryOperator(BoundBinaryOperator node, BoundUnaryO
case
BinaryOperatorKind
.
ULongMultiplication
:
if
(
loweredLeft
.
IsDefaultValue
())
{
return
_factory
.
Sequence
(
loweredRight
,
loweredLeft
);
return
_factory
.
Make
Sequence
(
loweredRight
,
loweredLeft
);
}
if
(
loweredRight
.
IsDefaultValue
())
{
return
_factory
.
Sequence
(
loweredLeft
,
loweredRight
);
return
_factory
.
Make
Sequence
(
loweredLeft
,
loweredRight
);
}
if
(
loweredLeft
.
ConstantValue
?.
UInt64Value
==
1
)
{
...
...
@@ -794,7 +800,7 @@ private BoundExpression MakeTruthTestForDynamicLogicalOperator(SyntaxNode syntax
else
{
BoundExpression
falseExpr
=
MakeBooleanConstant
(
syntax
,
operatorKind
==
BinaryOperatorKind
.
NotEqual
);
return
_factory
.
Sequence
(
maybeNull
,
falseExpr
);
return
_factory
.
Make
Sequence
(
maybeNull
,
falseExpr
);
}
}
...
...
src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_CompoundAssignmentOperator.cs
浏览文件 @
73aa7924
...
...
@@ -699,7 +699,7 @@ private BoundExpression BoxReceiver(BoundExpression rewrittenReceiver, NamedType
// common production of lowered lifted operators
// GetValueOrDefault is known to be not sideeffecting.
if
(
IsSpecialMember
(
method
.
OriginalDefinition
,
SpecialMember
.
System_Nullable_T_GetValueOrDefault
))
if
(
IsSpecialMember
(
method
,
SpecialMember
.
System_Nullable_T_GetValueOrDefault
))
{
return
ReadIsSideeffecting
(
call
.
ReceiverOpt
);
}
...
...
@@ -713,7 +713,7 @@ private BoundExpression BoxReceiver(BoundExpression rewrittenReceiver, NamedType
private
static
bool
IsSpecialMember
(
MethodSymbol
method
,
SpecialMember
specialMember
)
{
Debug
.
Assert
(
method
!=
null
)
;
method
=
method
.
OriginalDefinition
;
return
method
.
ContainingAssembly
?.
GetSpecialTypeMember
(
specialMember
)
==
method
;
}
...
...
src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_ConditionalAccess.cs
浏览文件 @
73aa7924
...
...
@@ -162,7 +162,7 @@ internal BoundExpression RewriteConditionalAccess(BoundConditionalAccess node, b
case
ConditionalAccessLoweringKind
.
TernaryCaptureReceiverByVal
:
// capture the receiver into a temp
loweredReceiver
=
_factory
.
Sequence
(
loweredReceiver
=
_factory
.
Make
Sequence
(
_factory
.
AssignmentExpression
(
_factory
.
Local
(
temp
),
loweredReceiver
),
_factory
.
Local
(
temp
));
...
...
@@ -186,7 +186,7 @@ internal BoundExpression RewriteConditionalAccess(BoundConditionalAccess node, b
if
(
temp
!=
null
)
{
result
=
_factory
.
Sequence
(
temp
,
result
);
result
=
_factory
.
Make
Sequence
(
temp
,
result
);
}
}
break
;
...
...
src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_Conversion.cs
浏览文件 @
73aa7924
...
...
@@ -640,7 +640,7 @@ private BoundExpression MakeImplicitConversion(BoundExpression rewrittenOperand,
}
var
result
=
MakeTupleCreationExpression
(
syntax
,
rewrittenType
,
fieldAccessorsBuilder
.
ToImmutableAndFree
());
return
_factory
.
Sequence
(
savedTuple
.
LocalSymbol
,
assignmentToTemp
,
result
);
return
_factory
.
Make
Sequence
(
savedTuple
.
LocalSymbol
,
assignmentToTemp
,
result
);
}
private
static
bool
NullableNeverHasValue
(
BoundExpression
expression
)
...
...
src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_Patterns.cs
浏览文件 @
73aa7924
...
...
@@ -58,7 +58,7 @@ private BoundExpression LowerDeclarationPattern(BoundDeclarationPattern pattern,
Debug
.
Assert
(
input
.
Type
==
pattern
.
LocalSymbol
.
Type
);
var
assignment
=
_factory
.
AssignmentExpression
(
_factory
.
Local
(
pattern
.
LocalSymbol
),
input
);
var
result
=
_factory
.
Literal
(
true
);
return
_factory
.
Sequence
(
assignment
,
result
);
return
_factory
.
Make
Sequence
(
assignment
,
result
);
}
return
MakeDeclarationPattern
(
pattern
.
Syntax
,
input
,
pattern
.
LocalSymbol
,
requiresNullTest
:
true
);
...
...
@@ -69,7 +69,7 @@ private BoundExpression LowerDeclarationPattern(BoundDeclarationPattern pattern,
/// </summary>
BoundExpression
LogicalAndForPatterns
(
BoundExpression
left
,
BoundExpression
right
)
{
return
IsIrrefutablePatternTest
(
left
)
?
_factory
.
Sequence
(
left
,
right
)
:
_factory
.
LogicalAnd
(
left
,
right
);
return
IsIrrefutablePatternTest
(
left
)
?
_factory
.
Make
Sequence
(
left
,
right
)
:
_factory
.
LogicalAnd
(
left
,
right
);
}
/// <summary>
...
...
@@ -125,13 +125,13 @@ BoundExpression MakeDeclarationPattern(SyntaxNode syntax, BoundExpression input,
var
result
=
requiresNullTest
?
_factory
.
ObjectNotEqual
(
_factory
.
Local
(
target
),
_factory
.
Null
(
type
))
:
(
BoundExpression
)
_factory
.
Literal
(
true
);
return
_factory
.
Sequence
(
assignment
,
result
);
return
_factory
.
Make
Sequence
(
assignment
,
result
);
}
else
{
var
assignment
=
_factory
.
AssignmentExpression
(
_factory
.
Local
(
target
),
_factory
.
As
(
input
,
type
));
var
result
=
_factory
.
ObjectNotEqual
(
_factory
.
Local
(
target
),
_factory
.
Null
(
type
));
return
_factory
.
Sequence
(
assignment
,
result
);
return
_factory
.
Make
Sequence
(
assignment
,
result
);
}
}
else
if
(
type
.
IsNullableType
())
...
...
@@ -146,7 +146,7 @@ BoundExpression MakeDeclarationPattern(SyntaxNode syntax, BoundExpression input,
// }
var
assignment
=
_factory
.
AssignmentExpression
(
_factory
.
Local
(
target
),
_factory
.
As
(
input
,
type
));
var
result
=
_factory
.
Call
(
_factory
.
Local
(
target
),
GetNullableMethod
(
syntax
,
type
,
SpecialMember
.
System_Nullable_T_get_HasValue
));
return
_factory
.
Sequence
(
assignment
,
result
);
return
_factory
.
Make
Sequence
(
assignment
,
result
);
}
else
if
(
type
.
IsValueType
)
{
...
...
@@ -154,7 +154,7 @@ BoundExpression MakeDeclarationPattern(SyntaxNode syntax, BoundExpression input,
// is irrefutable, and we can just do the assignment and return true.
if
(
input
.
Type
==
type
)
{
return
_factory
.
Sequence
(
return
_factory
.
Make
Sequence
(
_factory
.
AssignmentExpression
(
_factory
.
Local
(
target
),
input
),
_factory
.
Literal
(
true
));
}
...
...
@@ -175,7 +175,7 @@ BoundExpression MakeDeclarationPattern(SyntaxNode syntax, BoundExpression input,
GetNullableMethod
(
syntax
,
tmpType
,
SpecialMember
.
System_Nullable_T_GetValueOrDefault
));
var
asg2
=
_factory
.
AssignmentExpression
(
_factory
.
Local
(
target
),
value
);
var
result
=
requiresNullTest
?
MakeNullableHasValue
(
syntax
,
input
)
:
_factory
.
Literal
(
true
);
return
_factory
.
Sequence
(
asg2
,
result
);
return
_factory
.
Make
Sequence
(
asg2
,
result
);
}
else
{
...
...
@@ -186,7 +186,7 @@ BoundExpression MakeDeclarationPattern(SyntaxNode syntax, BoundExpression input,
GetNullableMethod
(
syntax
,
tmpType
,
SpecialMember
.
System_Nullable_T_GetValueOrDefault
));
var
asg2
=
_factory
.
AssignmentExpression
(
_factory
.
Local
(
target
),
value
);
var
result
=
MakeNullableHasValue
(
syntax
,
_factory
.
Local
(
tmp
));
return
_factory
.
Sequence
(
tmp
,
asg1
,
asg2
,
result
);
return
_factory
.
Make
Sequence
(
tmp
,
asg1
,
asg2
,
result
);
}
}
else
// type parameter
...
...
@@ -200,7 +200,7 @@ BoundExpression MakeDeclarationPattern(SyntaxNode syntax, BoundExpression input,
// return s;
// }
return
_factory
.
Conditional
(
_factory
.
Is
(
input
,
type
),
_factory
.
Sequence
(
_factory
.
AssignmentExpression
(
_factory
.
Make
Sequence
(
_factory
.
AssignmentExpression
(
_factory
.
Local
(
target
),
_factory
.
Convert
(
type
,
input
)),
_factory
.
Literal
(
true
)),
...
...
src/Compilers/CSharp/Portable/Lowering/SyntheticBoundNodeFactory.cs
浏览文件 @
73aa7924
...
...
@@ -734,17 +734,17 @@ public BoundLocal Local(LocalSymbol local)
return
new
BoundLocal
(
Syntax
,
local
,
null
,
local
.
Type
)
{
WasCompilerGenerated
=
true
};
}
public
BoundExpression
Sequence
(
LocalSymbol
temp
,
params
BoundExpression
[]
parts
)
public
BoundExpression
Make
Sequence
(
LocalSymbol
temp
,
params
BoundExpression
[]
parts
)
{
return
Sequence
(
ImmutableArray
.
Create
<
LocalSymbol
>(
temp
),
parts
);
return
Make
Sequence
(
ImmutableArray
.
Create
<
LocalSymbol
>(
temp
),
parts
);
}
public
BoundExpression
Sequence
(
params
BoundExpression
[]
parts
)
public
BoundExpression
Make
Sequence
(
params
BoundExpression
[]
parts
)
{
return
Sequence
(
ImmutableArray
<
LocalSymbol
>.
Empty
,
parts
);
return
Make
Sequence
(
ImmutableArray
<
LocalSymbol
>.
Empty
,
parts
);
}
public
BoundExpression
Sequence
(
ImmutableArray
<
LocalSymbol
>
locals
,
params
BoundExpression
[]
parts
)
public
BoundExpression
Make
Sequence
(
ImmutableArray
<
LocalSymbol
>
locals
,
params
BoundExpression
[]
parts
)
{
var
builder
=
ArrayBuilder
<
BoundExpression
>.
GetInstance
();
for
(
int
i
=
0
;
i
<
parts
.
Length
-
1
;
i
++)
...
...
@@ -766,12 +766,12 @@ public BoundExpression Sequence(ImmutableArray<LocalSymbol> locals, params Bound
return
Sequence
(
locals
,
builder
.
ToImmutableAndFree
(),
lastExpression
);
}
public
Bound
Expression
Sequence
(
BoundExpression
[]
sideEffects
,
BoundExpression
result
,
TypeSymbol
type
=
null
)
public
Bound
Sequence
Sequence
(
BoundExpression
[]
sideEffects
,
BoundExpression
result
,
TypeSymbol
type
=
null
)
{
return
new
BoundSequence
(
Syntax
,
ImmutableArray
<
LocalSymbol
>.
Empty
,
sideEffects
.
AsImmutableOrNull
(),
result
,
type
??
result
.
Type
)
{
WasCompilerGenerated
=
true
};
}
public
Bound
Expression
Sequence
(
ImmutableArray
<
LocalSymbol
>
locals
,
ImmutableArray
<
BoundExpression
>
sideEffects
,
BoundExpression
result
)
public
Bound
Sequence
Sequence
(
ImmutableArray
<
LocalSymbol
>
locals
,
ImmutableArray
<
BoundExpression
>
sideEffects
,
BoundExpression
result
)
{
return
new
BoundSequence
(
Syntax
,
locals
,
sideEffects
,
result
,
result
.
Type
)
{
WasCompilerGenerated
=
true
};
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录