Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
5d3e45e8
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,发现更多精彩内容 >>
提交
5d3e45e8
编写于
6月 03, 2016
作者:
N
Neal Gafter
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Snapshot of working state
上级
6a15f474
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
9 addition
and
7 deletion
+9
-7
src/Compilers/CSharp/Portable/Binder/SwitchBinder.cs
src/Compilers/CSharp/Portable/Binder/SwitchBinder.cs
+1
-1
src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_MatchStatement.cs
...le/Lowering/LocalRewriter/LocalRewriter_MatchStatement.cs
+1
-0
src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_PatternSwitchStatement.cs
...ing/LocalRewriter/LocalRewriter_PatternSwitchStatement.cs
+2
-1
src/Compilers/CSharp/Test/Emit/Emit/CompilationEmitTests.cs
src/Compilers/CSharp/Test/Emit/Emit/CompilationEmitTests.cs
+5
-5
未找到文件。
src/Compilers/CSharp/Portable/Binder/SwitchBinder.cs
浏览文件 @
5d3e45e8
...
...
@@ -32,7 +32,7 @@ internal static SwitchBinder Create(Binder next, SwitchStatementSyntax switchSyn
// compatible with the existing syntax and semantics, we will remove *this* binder
// and use the new one for binding all switch statements.
return
((
switchSyntax
?.
SyntaxTree
?.
Options
as
CSharpParseOptions
)?.
IsFeatureEnabled
(
MessageID
.
IDS_FeaturePatternMatching
)
!=
false
)
true
||
((
switchSyntax
?.
SyntaxTree
?.
Options
as
CSharpParseOptions
)?.
IsFeatureEnabled
(
MessageID
.
IDS_FeaturePatternMatching
)
!=
false
)
?
new
PatternSwitchBinder
(
next
,
switchSyntax
)
:
new
SwitchBinder
(
next
,
switchSyntax
);
}
...
...
src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_MatchStatement.cs
浏览文件 @
5d3e45e8
...
...
@@ -67,6 +67,7 @@ private BoundNode VisitPatternSwitchStatement_Ifchain(BoundPatternSwitchStatemen
}
statements
.
Add
(
_factory
.
Label
(
node
.
BreakLabel
));
_factory
.
Syntax
=
node
.
Syntax
;
return
_factory
.
Block
(
node
.
InnerLocals
.
Add
(
switchExpressionTemp
.
LocalSymbol
),
node
.
InnerLocalFunctions
,
statements
.
ToImmutableAndFree
());
}
}
...
...
src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_PatternSwitchStatement.cs
浏览文件 @
5d3e45e8
...
...
@@ -19,12 +19,13 @@ internal partial class LocalRewriter
// then we use the transitional code which translates a pattern switch into a series of
// if-then-else statements. Ultimately we need the new translation to be used to generate
// switch IL instructions for ordinary old-style switch statements.
private
static
bool
UseNewTranslation
(
BoundPatternSwitchStatement
node
)
=>
fals
e
;
private
static
bool
UseNewTranslation
(
BoundPatternSwitchStatement
node
)
=>
tru
e
;
public
override
BoundNode
VisitPatternSwitchStatement
(
BoundPatternSwitchStatement
node
)
{
// Until this is all implemented, we use a dumb series of if-then-else
// statements to translate the switch statement.
_factory
.
Syntax
=
node
.
Syntax
;
if
(!
UseNewTranslation
(
node
))
return
VisitPatternSwitchStatement_Ifchain
(
node
);
var
usedLabels
=
new
HashSet
<
LabelSymbol
>();
...
...
src/Compilers/CSharp/Test/Emit/Emit/CompilationEmitTests.cs
浏览文件 @
5d3e45e8
...
...
@@ -519,10 +519,10 @@ public static object TestSwitch(int val)
{
switch (val)
{
case (int)int.MinValue:
case (int)int.MinValue + 1:
case (int)short.MinValue:
case (int)short.MinValue + 1:
case (int)int.MinValue:
case (int)int.MinValue + 1:
case (int)short.MinValue:
case (int)short.MinValue + 1:
case (int)sbyte.MinValue: return 0;
case (int)-1: return -1;
case (int)0: return 0;
...
...
@@ -531,7 +531,7 @@ public static object TestSwitch(int val)
case (int)0xFE: return 0;
case (int)0xFF: return 0;
case (int)0x7FFE: return 0;
case (int)0xFFFE:
case (int)0xFFFE:
case (int)0x7FFFFFFF: return 0;
default: return null;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录