Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
5e77dcc8
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,发现更多精彩内容 >>
提交
5e77dcc8
编写于
9月 15, 2017
作者:
M
Manish Vasani
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Refactor code hardcode CaseClauseKind in constructors
上级
1feeb9e5
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
25 addition
and
28 deletion
+25
-28
src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory.cs
...lers/CSharp/Portable/Operations/CSharpOperationFactory.cs
+1
-1
src/Compilers/Core/Portable/Generated/Operations.xml.Generated.cs
...ilers/Core/Portable/Generated/Operations.xml.Generated.cs
+18
-18
src/Compilers/Core/Portable/Operations/OperationCloner.cs
src/Compilers/Core/Portable/Operations/OperationCloner.cs
+3
-3
src/Compilers/VisualBasic/Portable/Operations/VisualBasicOperationFactory.vb
...lBasic/Portable/Operations/VisualBasicOperationFactory.vb
+3
-6
未找到文件。
src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory.cs
浏览文件 @
5e77dcc8
...
...
@@ -1246,7 +1246,7 @@ private ICaseClause CreateBoundSwitchLabelOperation(BoundSwitchLabel boundSwitch
if
(
boundSwitchLabel
.
ExpressionOpt
!=
null
)
{
Lazy
<
IOperation
>
value
=
new
Lazy
<
IOperation
>(()
=>
Create
(
boundSwitchLabel
.
ExpressionOpt
));
return
new
LazySingleValueCaseClause
(
value
,
CaseKind
.
SingleValue
,
_semanticModel
,
syntax
,
type
,
constantValue
,
isImplicit
);
return
new
LazySingleValueCaseClause
(
value
,
_semanticModel
,
syntax
,
type
,
constantValue
,
isImplicit
);
}
else
{
...
...
src/Compilers/Core/Portable/Generated/Operations.xml.Generated.cs
浏览文件 @
5e77dcc8
...
...
@@ -3796,8 +3796,8 @@ public override void Accept(OperationVisitor visitor)
/// </summary>
internal
abstract
partial
class
BaseRangeCaseClause
:
CaseClause
,
IRangeCaseClause
{
public
BaseRangeCaseClause
(
CaseKind
caseKind
,
SemanticModel
semanticModel
,
SyntaxNode
syntax
,
ITypeSymbol
type
,
Optional
<
object
>
constantValue
,
bool
isImplicit
)
:
base
(
caseKind
,
semanticModel
,
syntax
,
type
,
constantValue
,
isImplicit
)
public
BaseRangeCaseClause
(
SemanticModel
semanticModel
,
SyntaxNode
syntax
,
ITypeSymbol
type
,
Optional
<
object
>
constantValue
,
bool
isImplicit
)
:
base
(
CaseKind
.
Range
,
semanticModel
,
syntax
,
type
,
constantValue
,
isImplicit
)
{
}
...
...
@@ -3835,8 +3835,8 @@ public override void Accept(OperationVisitor visitor)
/// </summary>
internal
sealed
partial
class
RangeCaseClause
:
BaseRangeCaseClause
,
IRangeCaseClause
{
public
RangeCaseClause
(
IOperation
minimumValue
,
IOperation
maximumValue
,
CaseKind
caseKind
,
SemanticModel
semanticModel
,
SyntaxNode
syntax
,
ITypeSymbol
type
,
Optional
<
object
>
constantValue
,
bool
isImplicit
)
:
base
(
caseKind
,
semanticModel
,
syntax
,
type
,
constantValue
,
isImplicit
)
public
RangeCaseClause
(
IOperation
minimumValue
,
IOperation
maximumValue
,
SemanticModel
semanticModel
,
SyntaxNode
syntax
,
ITypeSymbol
type
,
Optional
<
object
>
constantValue
,
bool
isImplicit
)
:
base
(
semanticModel
,
syntax
,
type
,
constantValue
,
isImplicit
)
{
MinimumValueImpl
=
minimumValue
;
MaximumValueImpl
=
maximumValue
;
...
...
@@ -3854,8 +3854,8 @@ internal sealed partial class LazyRangeCaseClause : BaseRangeCaseClause, IRangeC
private
readonly
Lazy
<
IOperation
>
_lazyMinimumValue
;
private
readonly
Lazy
<
IOperation
>
_lazyMaximumValue
;
public
LazyRangeCaseClause
(
Lazy
<
IOperation
>
minimumValue
,
Lazy
<
IOperation
>
maximumValue
,
CaseKind
caseKind
,
SemanticModel
semanticModel
,
SyntaxNode
syntax
,
ITypeSymbol
type
,
Optional
<
object
>
constantValue
,
bool
isImplicit
)
:
base
(
caseKind
,
semanticModel
,
syntax
,
type
,
constantValue
,
isImplicit
)
public
LazyRangeCaseClause
(
Lazy
<
IOperation
>
minimumValue
,
Lazy
<
IOperation
>
maximumValue
,
SemanticModel
semanticModel
,
SyntaxNode
syntax
,
ITypeSymbol
type
,
Optional
<
object
>
constantValue
,
bool
isImplicit
)
:
base
(
semanticModel
,
syntax
,
type
,
constantValue
,
isImplicit
)
{
_lazyMinimumValue
=
minimumValue
??
throw
new
System
.
ArgumentNullException
(
nameof
(
minimumValue
));
_lazyMaximumValue
=
maximumValue
??
throw
new
System
.
ArgumentNullException
(
nameof
(
maximumValue
));
...
...
@@ -3871,8 +3871,8 @@ internal sealed partial class LazyRangeCaseClause : BaseRangeCaseClause, IRangeC
/// </summary>
internal
abstract
partial
class
BaseRelationalCaseClause
:
CaseClause
,
IRelationalCaseClause
{
public
BaseRelationalCaseClause
(
BinaryOperatorKind
relation
,
CaseKind
caseKind
,
SemanticModel
semanticModel
,
SyntaxNode
syntax
,
ITypeSymbol
type
,
Optional
<
object
>
constantValue
,
bool
isImplicit
)
:
base
(
caseKind
,
semanticModel
,
syntax
,
type
,
constantValue
,
isImplicit
)
public
BaseRelationalCaseClause
(
BinaryOperatorKind
relation
,
SemanticModel
semanticModel
,
SyntaxNode
syntax
,
ITypeSymbol
type
,
Optional
<
object
>
constantValue
,
bool
isImplicit
)
:
base
(
CaseKind
.
Relational
,
semanticModel
,
syntax
,
type
,
constantValue
,
isImplicit
)
{
Relation
=
relation
;
}
...
...
@@ -3909,8 +3909,8 @@ public override void Accept(OperationVisitor visitor)
/// </summary>
internal
sealed
partial
class
RelationalCaseClause
:
BaseRelationalCaseClause
,
IRelationalCaseClause
{
public
RelationalCaseClause
(
IOperation
value
,
BinaryOperatorKind
relation
,
CaseKind
caseKind
,
SemanticModel
semanticModel
,
SyntaxNode
syntax
,
ITypeSymbol
type
,
Optional
<
object
>
constantValue
,
bool
isImplicit
)
:
base
(
relation
,
caseKind
,
semanticModel
,
syntax
,
type
,
constantValue
,
isImplicit
)
public
RelationalCaseClause
(
IOperation
value
,
BinaryOperatorKind
relation
,
SemanticModel
semanticModel
,
SyntaxNode
syntax
,
ITypeSymbol
type
,
Optional
<
object
>
constantValue
,
bool
isImplicit
)
:
base
(
relation
,
semanticModel
,
syntax
,
type
,
constantValue
,
isImplicit
)
{
ValueImpl
=
value
;
}
...
...
@@ -3925,8 +3925,8 @@ internal sealed partial class LazyRelationalCaseClause : BaseRelationalCaseClaus
{
private
readonly
Lazy
<
IOperation
>
_lazyValue
;
public
LazyRelationalCaseClause
(
Lazy
<
IOperation
>
value
,
BinaryOperatorKind
relation
,
CaseKind
caseKind
,
SemanticModel
semanticModel
,
SyntaxNode
syntax
,
ITypeSymbol
type
,
Optional
<
object
>
constantValue
,
bool
isImplicit
)
:
base
(
relation
,
caseKind
,
semanticModel
,
syntax
,
type
,
constantValue
,
isImplicit
)
public
LazyRelationalCaseClause
(
Lazy
<
IOperation
>
value
,
BinaryOperatorKind
relation
,
SemanticModel
semanticModel
,
SyntaxNode
syntax
,
ITypeSymbol
type
,
Optional
<
object
>
constantValue
,
bool
isImplicit
)
:
base
(
relation
,
semanticModel
,
syntax
,
type
,
constantValue
,
isImplicit
)
{
_lazyValue
=
value
??
throw
new
System
.
ArgumentNullException
(
nameof
(
value
));
}
...
...
@@ -4017,8 +4017,8 @@ public LazyReturnStatement(OperationKind kind, Lazy<IOperation> returnedValue, S
/// </summary>
internal
abstract
partial
class
BaseSingleValueCaseClause
:
CaseClause
,
ISingleValueCaseClause
{
public
BaseSingleValueCaseClause
(
CaseKind
caseKind
,
SemanticModel
semanticModel
,
SyntaxNode
syntax
,
ITypeSymbol
type
,
Optional
<
object
>
constantValue
,
bool
isImplicit
)
:
base
(
caseKind
,
semanticModel
,
syntax
,
type
,
constantValue
,
isImplicit
)
public
BaseSingleValueCaseClause
(
SemanticModel
semanticModel
,
SyntaxNode
syntax
,
ITypeSymbol
type
,
Optional
<
object
>
constantValue
,
bool
isImplicit
)
:
base
(
CaseKind
.
SingleValue
,
semanticModel
,
syntax
,
type
,
constantValue
,
isImplicit
)
{
}
...
...
@@ -4050,8 +4050,8 @@ public override void Accept(OperationVisitor visitor)
/// </summary>
internal
sealed
partial
class
SingleValueCaseClause
:
BaseSingleValueCaseClause
,
ISingleValueCaseClause
{
public
SingleValueCaseClause
(
IOperation
value
,
CaseKind
caseKind
,
SemanticModel
semanticModel
,
SyntaxNode
syntax
,
ITypeSymbol
type
,
Optional
<
object
>
constantValue
,
bool
isImplicit
)
:
base
(
caseKind
,
semanticModel
,
syntax
,
type
,
constantValue
,
isImplicit
)
public
SingleValueCaseClause
(
IOperation
value
,
SemanticModel
semanticModel
,
SyntaxNode
syntax
,
ITypeSymbol
type
,
Optional
<
object
>
constantValue
,
bool
isImplicit
)
:
base
(
semanticModel
,
syntax
,
type
,
constantValue
,
isImplicit
)
{
ValueImpl
=
value
;
}
...
...
@@ -4066,8 +4066,8 @@ internal sealed partial class LazySingleValueCaseClause : BaseSingleValueCaseCla
{
private
readonly
Lazy
<
IOperation
>
_lazyValue
;
public
LazySingleValueCaseClause
(
Lazy
<
IOperation
>
value
,
CaseKind
caseKind
,
SemanticModel
semanticModel
,
SyntaxNode
syntax
,
ITypeSymbol
type
,
Optional
<
object
>
constantValue
,
bool
isImplicit
)
:
base
(
caseKind
,
semanticModel
,
syntax
,
type
,
constantValue
,
isImplicit
)
public
LazySingleValueCaseClause
(
Lazy
<
IOperation
>
value
,
SemanticModel
semanticModel
,
SyntaxNode
syntax
,
ITypeSymbol
type
,
Optional
<
object
>
constantValue
,
bool
isImplicit
)
:
base
(
semanticModel
,
syntax
,
type
,
constantValue
,
isImplicit
)
{
_lazyValue
=
value
??
throw
new
System
.
ArgumentNullException
(
nameof
(
value
));
}
...
...
src/Compilers/Core/Portable/Operations/OperationCloner.cs
浏览文件 @
5e77dcc8
...
...
@@ -61,17 +61,17 @@ public override IOperation VisitSwitchCase(ISwitchCase operation, object argumen
public
override
IOperation
VisitSingleValueCaseClause
(
ISingleValueCaseClause
operation
,
object
argument
)
{
return
new
SingleValueCaseClause
(
Visit
(
operation
.
Value
),
operation
.
CaseKind
,
((
Operation
)
operation
).
SemanticModel
,
operation
.
Syntax
,
operation
.
Type
,
operation
.
ConstantValue
,
operation
.
IsImplicit
);
return
new
SingleValueCaseClause
(
Visit
(
operation
.
Value
),
((
Operation
)
operation
).
SemanticModel
,
operation
.
Syntax
,
operation
.
Type
,
operation
.
ConstantValue
,
operation
.
IsImplicit
);
}
public
override
IOperation
VisitRelationalCaseClause
(
IRelationalCaseClause
operation
,
object
argument
)
{
return
new
RelationalCaseClause
(
Visit
(
operation
.
Value
),
operation
.
Relation
,
operation
.
CaseKind
,
((
Operation
)
operation
).
SemanticModel
,
operation
.
Syntax
,
operation
.
Type
,
operation
.
ConstantValue
,
operation
.
IsImplicit
);
return
new
RelationalCaseClause
(
Visit
(
operation
.
Value
),
operation
.
Relation
,
((
Operation
)
operation
).
SemanticModel
,
operation
.
Syntax
,
operation
.
Type
,
operation
.
ConstantValue
,
operation
.
IsImplicit
);
}
public
override
IOperation
VisitRangeCaseClause
(
IRangeCaseClause
operation
,
object
argument
)
{
return
new
RangeCaseClause
(
Visit
(
operation
.
MinimumValue
),
Visit
(
operation
.
MaximumValue
),
operation
.
CaseKind
,
((
Operation
)
operation
).
SemanticModel
,
operation
.
Syntax
,
operation
.
Type
,
operation
.
ConstantValue
,
operation
.
IsImplicit
);
return
new
RangeCaseClause
(
Visit
(
operation
.
MinimumValue
),
Visit
(
operation
.
MaximumValue
),
((
Operation
)
operation
).
SemanticModel
,
operation
.
Syntax
,
operation
.
Type
,
operation
.
ConstantValue
,
operation
.
IsImplicit
);
}
public
override
IOperation
VisitDefaultCaseClause
(
IDefaultCaseClause
operation
,
object
argument
)
...
...
src/Compilers/VisualBasic/Portable/Operations/VisualBasicOperationFactory.vb
浏览文件 @
5e77dcc8
...
...
@@ -861,12 +861,11 @@ Namespace Microsoft.CodeAnalysis.Semantics
Private
Function
CreateBoundSimpleCaseClauseOperation
(
boundSimpleCaseClause
As
BoundSimpleCaseClause
)
As
ISingleValueCaseClause
Dim
clauseValue
=
GetSingleValueCaseClauseValue
(
boundSimpleCaseClause
)
Dim
value
As
Lazy
(
Of
IOperation
)
=
New
Lazy
(
Of
IOperation
)(
Function
()
Create
(
clauseValue
))
Dim
CaseKind
As
CaseKind
=
CaseKind
.
SingleValue
Dim
syntax
As
SyntaxNode
=
boundSimpleCaseClause
.
Syntax
Dim
type
As
ITypeSymbol
=
Nothing
Dim
constantValue
As
[
Optional
]
(
Of
Object
)
=
New
[
Optional
]
(
Of
Object
)()
Dim
isImplicit
As
Boolean
=
boundSimpleCaseClause
.
WasCompilerGenerated
Return
New
LazySingleValueCaseClause
(
value
,
CaseKind
,
_semanticModel
,
syntax
,
type
,
constantValue
,
isImplicit
)
Return
New
LazySingleValueCaseClause
(
value
,
_semanticModel
,
syntax
,
type
,
constantValue
,
isImplicit
)
End
Function
Private
Function
CreateBoundRangeCaseClauseOperation
(
boundRangeCaseClause
As
BoundRangeCaseClause
)
As
IRangeCaseClause
...
...
@@ -900,24 +899,22 @@ Namespace Microsoft.CodeAnalysis.Semantics
Return
Nothing
End
Function
)
Dim
CaseKind
As
CaseKind
=
CaseKind
.
Range
Dim
syntax
As
SyntaxNode
=
boundRangeCaseClause
.
Syntax
Dim
type
As
ITypeSymbol
=
Nothing
Dim
constantValue
As
[
Optional
]
(
Of
Object
)
=
New
[
Optional
]
(
Of
Object
)()
Dim
isImplicit
As
Boolean
=
boundRangeCaseClause
.
WasCompilerGenerated
Return
New
LazyRangeCaseClause
(
minimumValue
,
maximumValue
,
CaseKind
,
_semanticModel
,
syntax
,
type
,
constantValue
,
isImplicit
)
Return
New
LazyRangeCaseClause
(
minimumValue
,
maximumValue
,
_semanticModel
,
syntax
,
type
,
constantValue
,
isImplicit
)
End
Function
Private
Function
CreateBoundRelationalCaseClauseOperation
(
boundRelationalCaseClause
As
BoundRelationalCaseClause
)
As
IRelationalCaseClause
Dim
valueExpression
=
GetRelationalCaseClauseValue
(
boundRelationalCaseClause
)
Dim
value
As
Lazy
(
Of
IOperation
)
=
New
Lazy
(
Of
IOperation
)(
Function
()
Create
(
valueExpression
))
Dim
relation
As
BinaryOperatorKind
=
If
(
valueExpression
IsNot
Nothing
,
Helper
.
DeriveBinaryOperatorKind
(
boundRelationalCaseClause
.
OperatorKind
,
leftOpt
:
=
Nothing
),
BinaryOperatorKind
.
Invalid
)
Dim
CaseKind
As
CaseKind
=
CaseKind
.
Relational
Dim
syntax
As
SyntaxNode
=
boundRelationalCaseClause
.
Syntax
Dim
type
As
ITypeSymbol
=
Nothing
Dim
constantValue
As
[
Optional
]
(
Of
Object
)
=
New
[
Optional
]
(
Of
Object
)()
Dim
isImplicit
As
Boolean
=
boundRelationalCaseClause
.
WasCompilerGenerated
Return
New
LazyRelationalCaseClause
(
value
,
relation
,
CaseKind
,
_semanticModel
,
syntax
,
type
,
constantValue
,
isImplicit
)
Return
New
LazyRelationalCaseClause
(
value
,
relation
,
_semanticModel
,
syntax
,
type
,
constantValue
,
isImplicit
)
End
Function
Private
Function
CreateBoundDoLoopStatementOperation
(
boundDoLoopStatement
As
BoundDoLoopStatement
)
As
IDoLoopStatement
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录