Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
683a457b
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,发现更多精彩内容 >>
提交
683a457b
编写于
5月 17, 2017
作者:
J
Julien Couvreur
提交者:
GitHub
5月 17, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add missing sequence point in lowering of conditional statement (#19336)
上级
f9f2b179
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
324 addition
and
33 deletion
+324
-33
src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_IfStatement.cs
...table/Lowering/LocalRewriter/LocalRewriter_IfStatement.cs
+2
-0
src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_ReturnStatement.cs
...e/Lowering/LocalRewriter/LocalRewriter_ReturnStatement.cs
+0
-4
src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenLockTests.cs
src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenLockTests.cs
+3
-3
src/Compilers/CSharp/Test/Emit/Emit/EditAndContinue/LocalSlotMappingTests.cs
...p/Test/Emit/Emit/EditAndContinue/LocalSlotMappingTests.cs
+8
-4
src/Compilers/CSharp/Test/Emit/PDB/PDBAsyncTests.cs
src/Compilers/CSharp/Test/Emit/PDB/PDBAsyncTests.cs
+1
-12
src/Compilers/CSharp/Test/Emit/PDB/PDBIteratorTests.cs
src/Compilers/CSharp/Test/Emit/PDB/PDBIteratorTests.cs
+2
-0
src/Compilers/CSharp/Test/Emit/PDB/PDBLambdaTests.cs
src/Compilers/CSharp/Test/Emit/PDB/PDBLambdaTests.cs
+2
-0
src/Compilers/CSharp/Test/Emit/PDB/PDBTests.cs
src/Compilers/CSharp/Test/Emit/PDB/PDBTests.cs
+304
-9
src/Compilers/CSharp/Test/Emit/PDB/PDBTupleTests.cs
src/Compilers/CSharp/Test/Emit/PDB/PDBTupleTests.cs
+1
-0
src/Compilers/CSharp/Test/Emit/PDB/PDBUsingTests.cs
src/Compilers/CSharp/Test/Emit/PDB/PDBUsingTests.cs
+1
-1
未找到文件。
src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_IfStatement.cs
浏览文件 @
683a457b
...
...
@@ -59,6 +59,7 @@ public override BoundNode VisitIfStatement(BoundIfStatement node)
builder
.
Add
(
new
BoundConditionalGoto
(
rewrittenCondition
.
Syntax
,
rewrittenCondition
,
false
,
afterif
));
builder
.
Add
(
rewrittenConsequence
);
builder
.
Add
(
new
BoundSequencePoint
(
null
,
null
));
builder
.
Add
(
new
BoundLabelStatement
(
syntax
,
afterif
));
var
statements
=
builder
.
ToImmutableAndFree
();
return
new
BoundStatementList
(
syntax
,
statements
,
hasErrors
);
...
...
@@ -86,6 +87,7 @@ public override BoundNode VisitIfStatement(BoundIfStatement node)
builder
.
Add
(
new
BoundGotoStatement
(
syntax
,
afterif
));
builder
.
Add
(
new
BoundLabelStatement
(
syntax
,
alt
));
builder
.
Add
(
rewrittenAlternativeOpt
);
builder
.
Add
(
new
BoundSequencePoint
(
null
,
null
));
builder
.
Add
(
new
BoundLabelStatement
(
syntax
,
afterif
));
return
new
BoundStatementList
(
syntax
,
builder
.
ToImmutableAndFree
(),
hasErrors
);
}
...
...
src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_ReturnStatement.cs
浏览文件 @
683a457b
...
...
@@ -28,10 +28,6 @@ public override BoundNode VisitReturnStatement(BoundReturnStatement node)
{
rewritten
=
_instrumenter
.
InstrumentReturnStatement
(
node
,
rewritten
);
}
else
if
(
node
.
WasCompilerGenerated
&&
_factory
.
CurrentMethod
?.
IsAsync
==
true
)
{
rewritten
=
new
BoundSequencePoint
(
null
,
rewritten
);
}
return
rewritten
;
}
...
...
src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenLockTests.cs
浏览文件 @
683a457b
...
...
@@ -57,7 +57,7 @@ .maxstack 2
IL_0023: brfalse.s IL_002b
IL_0025: ldloc.0
IL_0026: call ""void System.Threading.Monitor.Exit(object)""
IL_002b: endfinally
~
IL_002b: endfinally
}
-IL_002c: ldstr ""After""
IL_0031: call ""void System.Console.WriteLine(string)""
...
...
@@ -112,7 +112,7 @@ .maxstack 2
IL_0027: brfalse.s IL_002f
IL_0029: ldloc.0
IL_002a: call ""void System.Threading.Monitor.Exit(object)""
IL_002f: endfinally
~
IL_002f: endfinally
}
-IL_0030: ldstr ""After""
IL_0035: call ""void System.Console.WriteLine(string)""
...
...
@@ -387,7 +387,7 @@ .maxstack 2
IL_0027: brfalse.s IL_002f
IL_0029: ldloc.0
IL_002a: call ""void System.Threading.Monitor.Exit(object)""
IL_002f: endfinally
~
IL_002f: endfinally
}
-IL_0030: ldstr ""After""
IL_0035: call ""void System.Console.WriteLine(string)""
...
...
src/Compilers/CSharp/Test/Emit/Emit/EditAndContinue/LocalSlotMappingTests.cs
浏览文件 @
683a457b
...
...
@@ -349,10 +349,12 @@ static void M()
<entry offset=""0x12"" startLine=""9"" startColumn=""20"" endLine=""9"" endColumn=""21"" />
<entry offset=""0x13"" startLine=""9"" startColumn=""22"" endLine=""9"" endColumn=""23"" />
<entry offset=""0x16"" hidden=""true"" />
<entry offset=""0x20"" hidden=""true"" />
<entry offset=""0x21"" startLine=""10"" startColumn=""9"" endLine=""10"" endColumn=""20"" />
<entry offset=""0x27"" startLine=""10"" startColumn=""21"" endLine=""10"" endColumn=""22"" />
<entry offset=""0x28"" startLine=""10"" startColumn=""23"" endLine=""10"" endColumn=""24"" />
<entry offset=""0x2b"" hidden=""true"" />
<entry offset=""0x35"" hidden=""true"" />
<entry offset=""0x36"" startLine=""11"" startColumn=""5"" endLine=""11"" endColumn=""6"" />
</sequencePoints>
</method>
...
...
@@ -370,9 +372,11 @@ static void M()
<entry offset=""0x0"" startLine=""9"" startColumn=""9"" endLine=""9"" endColumn=""19"" />
<entry offset=""0x10"" startLine=""9"" startColumn=""22"" endLine=""9"" endColumn=""23"" />
<entry offset=""0x12"" hidden=""true"" />
<entry offset=""0x1b"" hidden=""true"" />
<entry offset=""0x1c"" startLine=""10"" startColumn=""9"" endLine=""10"" endColumn=""20"" />
<entry offset=""0x22"" startLine=""10"" startColumn=""23"" endLine=""10"" endColumn=""24"" />
<entry offset=""0x24"" hidden=""true"" />
<entry offset=""0x2d"" hidden=""true"" />
<entry offset=""0x2e"" startLine=""11"" startColumn=""5"" endLine=""11"" endColumn=""6"" />
</sequencePoints>
</method>
...
...
@@ -559,7 +563,7 @@ .maxstack 2
IL_002b: ldloc.2
IL_002c: call ""void System.Threading.Monitor.Exit(object)""
IL_0031: nop
IL_0032: endfinally
~
IL_0032: endfinally
}
-IL_0033: nop
IL_0034: leave.s IL_0041
...
...
@@ -571,7 +575,7 @@ .maxstack 2
IL_0039: ldloc.0
IL_003a: call ""void System.Threading.Monitor.Exit(object)""
IL_003f: nop
IL_0040: endfinally
~
IL_0040: endfinally
}
-IL_0041: ret
}
...
...
@@ -1787,7 +1791,7 @@ .maxstack 2
IL_0010: ldloc.s V_6
IL_0012: callvirt ""void System.IDisposable.Dispose()""
IL_0017: nop
IL_0018: endfinally
~
IL_0018: endfinally
}
-IL_0019: call ""object C.F1()""
IL_001e: stloc.0
...
...
@@ -1810,7 +1814,7 @@ .maxstack 2
IL_0031: ldloc.0
IL_0032: call ""void System.Threading.Monitor.Exit(object)""
IL_0037: nop
IL_0038: endfinally
~
IL_0038: endfinally
}
-IL_0039: nop
-IL_003a: call ""string C.F2()""
...
...
src/Compilers/CSharp/Test/Emit/PDB/PDBAsyncTests.cs
浏览文件 @
683a457b
...
...
@@ -159,7 +159,7 @@ .maxstack 3
-IL_00e5: ldsfld ""System.Threading.AutoResetEvent Driver.CompletedSignal""
IL_00ea: callvirt ""bool System.Threading.EventWaitHandle.Set()""
IL_00ef: pop
~
IL_00f0: leave.s IL_010c
IL_00f0: leave.s IL_010c
}
catch System.Exception
{
...
...
@@ -288,7 +288,6 @@ .maxstack 3
<entry offset=""0xcd"" startLine=""18"" startColumn=""24"" endLine=""18"" endColumn=""32"" />
<entry offset=""0xd9"" startLine=""20"" startColumn=""9"" endLine=""20"" endColumn=""44"" />
<entry offset=""0xe5"" startLine=""22"" startColumn=""9"" endLine=""22"" endColumn=""38"" />
<entry offset=""0xf0"" hidden=""true"" />
<entry offset=""0xf2"" hidden=""true"" />
<entry offset=""0x10c"" startLine=""23"" startColumn=""5"" endLine=""23"" endColumn=""6"" />
<entry offset=""0x114"" hidden=""true"" />
...
...
@@ -444,7 +443,6 @@ private Task<int> GetNextInt(Random random)
<entry offset=""0xe"" startLine=""16"" startColumn=""9"" endLine=""16"" endColumn=""10"" />
<entry offset=""0xf"" startLine=""17"" startColumn=""13"" endLine=""17"" endColumn=""26"" />
<entry offset=""0x20"" hidden=""true"" />
<entry offset=""0x71"" hidden=""true"" />
<entry offset=""0x73"" hidden=""true"" />
<entry offset=""0x8b"" startLine=""18"" startColumn=""9"" endLine=""18"" endColumn=""10"" />
<entry offset=""0x93"" hidden=""true"" />
...
...
@@ -558,7 +556,6 @@ static async void Await(dynamic d)
<entry offset=""0x11"" startLine=""5"" startColumn=""5"" endLine=""5"" endColumn=""6"" />
<entry offset=""0x12"" startLine=""6"" startColumn=""9"" endLine=""6"" endColumn=""27"" />
<entry offset=""0xae"" hidden=""true"" />
<entry offset=""0x22c"" hidden=""true"" />
<entry offset=""0x22e"" hidden=""true"" />
<entry offset=""0x248"" startLine=""7"" startColumn=""5"" endLine=""7"" endColumn=""6"" />
<entry offset=""0x250"" hidden=""true"" />
...
...
@@ -756,7 +753,6 @@ static async Task M(int b)
<entry offset=""0x25"" startLine=""13"" startColumn=""9"" endLine=""13"" endColumn=""47"" />
<entry offset=""0x36"" startLine=""15"" startColumn=""9"" endLine=""15"" endColumn=""31"" />
<entry offset=""0x55"" hidden=""true"" />
<entry offset=""0xa1"" hidden=""true"" />
<entry offset=""0xa3"" hidden=""true"" />
<entry offset=""0xba"" startLine=""16"" startColumn=""5"" endLine=""16"" endColumn=""6"" />
<entry offset=""0xc2"" hidden=""true"" />
...
...
@@ -850,7 +846,6 @@ static async Task M(int b)
<entry offset=""0x41"" startLine=""13"" startColumn=""9"" endLine=""13"" endColumn=""47"" />
<entry offset=""0x58"" startLine=""15"" startColumn=""9"" endLine=""15"" endColumn=""31"" />
<entry offset=""0x86"" hidden=""true"" />
<entry offset=""0xd7"" hidden=""true"" />
<entry offset=""0xd9"" hidden=""true"" />
<entry offset=""0xf1"" startLine=""19"" startColumn=""5"" endLine=""19"" endColumn=""6"" />
<entry offset=""0xf9"" hidden=""true"" />
...
...
@@ -939,7 +934,6 @@ static async Task M(int b)
<entry offset=""0x4f"" startLine=""15"" startColumn=""9"" endLine=""15"" endColumn=""29"" />
<entry offset=""0x5b"" hidden=""true"" />
<entry offset=""0xa7"" startLine=""17"" startColumn=""9"" endLine=""17"" endColumn=""31"" />
<entry offset=""0xb7"" hidden=""true"" />
<entry offset=""0xb9"" hidden=""true"" />
<entry offset=""0xd0"" startLine=""18"" startColumn=""5"" endLine=""18"" endColumn=""6"" />
<entry offset=""0xd8"" hidden=""true"" />
...
...
@@ -1028,7 +1022,6 @@ static async Task M(int b)
<entry offset=""0x58"" startLine=""15"" startColumn=""9"" endLine=""15"" endColumn=""29"" />
<entry offset=""0x64"" hidden=""true"" />
<entry offset=""0xb5"" startLine=""17"" startColumn=""9"" endLine=""17"" endColumn=""31"" />
<entry offset=""0xc6"" hidden=""true"" />
<entry offset=""0xc8"" hidden=""true"" />
<entry offset=""0xe0"" startLine=""18"" startColumn=""5"" endLine=""18"" endColumn=""6"" />
<entry offset=""0xe8"" hidden=""true"" />
...
...
@@ -1117,7 +1110,6 @@ static async Task M()
<entry offset=""0x1b"" startLine=""9"" startColumn=""9"" endLine=""9"" endColumn=""29"" />
<entry offset=""0x27"" hidden=""true"" />
<entry offset=""0x7b"" startLine=""10"" startColumn=""9"" endLine=""10"" endColumn=""22"" />
<entry offset=""0xd3"" hidden=""true"" />
<entry offset=""0xd5"" hidden=""true"" />
<entry offset=""0xed"" startLine=""11"" startColumn=""5"" endLine=""11"" endColumn=""6"" />
<entry offset=""0xf5"" hidden=""true"" />
...
...
@@ -1196,7 +1188,6 @@ static async Task M()
<entry offset=""0x14"" startLine=""9"" startColumn=""9"" endLine=""9"" endColumn=""22"" />
<entry offset=""0x64"" startLine=""10"" startColumn=""9"" endLine=""10"" endColumn=""29"" />
<entry offset=""0x70"" hidden=""true"" />
<entry offset=""0xbc"" hidden=""true"" />
<entry offset=""0xbe"" hidden=""true"" />
<entry offset=""0xd5"" startLine=""11"" startColumn=""5"" endLine=""11"" endColumn=""6"" />
<entry offset=""0xdd"" hidden=""true"" />
...
...
@@ -1284,7 +1275,6 @@ static async Task M()
<entry offset=""0x1e"" startLine=""9"" startColumn=""9"" endLine=""9"" endColumn=""22"" />
<entry offset=""0x76"" startLine=""10"" startColumn=""9"" endLine=""10"" endColumn=""29"" />
<entry offset=""0x82"" hidden=""true"" />
<entry offset=""0xd3"" hidden=""true"" />
<entry offset=""0xd5"" hidden=""true"" />
<entry offset=""0xed"" startLine=""14"" startColumn=""5"" endLine=""14"" endColumn=""6"" />
<entry offset=""0xf5"" hidden=""true"" />
...
...
@@ -1731,7 +1721,6 @@ public partial class C
Document: #1
IL_0000: <hidden>
IL_0007: (5, 28) - (5, 29)
IL_0008: <hidden>
IL_000A: <hidden>
IL_0022: (5, 29) - (5, 30)
IL_002A: <hidden>
...
...
src/Compilers/CSharp/Test/Emit/PDB/PDBIteratorTests.cs
浏览文件 @
683a457b
...
...
@@ -403,6 +403,7 @@ static void Main()
<entry offset=""0x18"" startLine=""23"" startColumn=""13"" endLine=""23"" endColumn=""41"" />
<entry offset=""0x1d"" startLine=""21"" startColumn=""24"" endLine=""21"" endColumn=""26"" />
<entry offset=""0x27"" hidden=""true"" />
<entry offset=""0x30"" hidden=""true"" />
<entry offset=""0x31"" startLine=""25"" startColumn=""5"" endLine=""25"" endColumn=""6"" />
</sequencePoints>
<scope startOffset=""0x0"" endOffset=""0x32"">
...
...
@@ -555,6 +556,7 @@ public static void Main()
<entry offset=""0x17"" startLine=""46"" startColumn=""49"" endLine=""46"" endColumn=""50"" />
<entry offset=""0x18"" startLine=""46"" startColumn=""24"" endLine=""46"" endColumn=""26"" />
<entry offset=""0x22"" hidden=""true"" />
<entry offset=""0x2c"" hidden=""true"" />
<entry offset=""0x2d"" startLine=""47"" startColumn=""5"" endLine=""47"" endColumn=""6"" />
</sequencePoints>
<scope startOffset=""0x0"" endOffset=""0x2e"">
...
...
src/Compilers/CSharp/Test/Emit/PDB/PDBLambdaTests.cs
浏览文件 @
683a457b
...
...
@@ -1314,8 +1314,10 @@ static void F()
<entry offset=""0x4f"" startLine=""18"" startColumn=""13"" endLine=""18"" endColumn=""25"" />
<entry offset=""0x61"" startLine=""19"" startColumn=""9"" endLine=""19"" endColumn=""10"" />
<entry offset=""0x64"" hidden=""true"" />
<entry offset=""0x78"" hidden=""true"" />
<entry offset=""0x79"" hidden=""true"" />
<entry offset=""0x7b"" hidden=""true"" />
<entry offset=""0x8f"" hidden=""true"" />
<entry offset=""0x90"" startLine=""20"" startColumn=""5"" endLine=""20"" endColumn=""6"" />
</sequencePoints>
<scope startOffset=""0x0"" endOffset=""0x91"">
...
...
src/Compilers/CSharp/Test/Emit/PDB/PDBTests.cs
浏览文件 @
683a457b
...
...
@@ -2649,6 +2649,7 @@ static void Main(string[] args)
<entry offset=""0x3c"" startLine=""26"" startColumn=""13"" endLine=""26"" endColumn=""14"" />
<entry offset=""0x3d"" startLine=""12"" startColumn=""28"" endLine=""12"" endColumn=""30"" />
<entry offset=""0x47"" hidden=""true"" />
<entry offset=""0x51"" hidden=""true"" />
<entry offset=""0x52"" startLine=""27"" startColumn=""9"" endLine=""27"" endColumn=""10"" />
</sequencePoints>
<scope startOffset=""0x0"" endOffset=""0x53"">
...
...
@@ -4486,16 +4487,20 @@ static void Main()
<entry offset=""0xc"" startLine=""22"" startColumn=""62"" endLine=""22"" endColumn=""90"" />
<entry offset=""0x17"" startLine=""23"" startColumn=""13"" endLine=""23"" endColumn=""47"" />
<entry offset=""0x24"" hidden=""true"" />
<entry offset=""0x2e"" hidden=""true"" />
<entry offset=""0x2f"" hidden=""true"" />
<entry offset=""0x31"" hidden=""true"" />
<entry offset=""0x3b"" hidden=""true"" />
<entry offset=""0x3c"" startLine=""25"" startColumn=""16"" endLine=""25"" endColumn=""60"" />
<entry offset=""0x47"" startLine=""25"" startColumn=""62"" endLine=""25"" endColumn=""90"" />
<entry offset=""0x52"" startLine=""26"" startColumn=""9"" endLine=""26"" endColumn=""10"" />
<entry offset=""0x53"" startLine=""27"" startColumn=""13"" endLine=""27"" endColumn=""48"" />
<entry offset=""0x5e"" startLine=""28"" startColumn=""9"" endLine=""28"" endColumn=""10"" />
<entry offset=""0x61"" hidden=""true"" />
<entry offset=""0x6b"" hidden=""true"" />
<entry offset=""0x6c"" hidden=""true"" />
<entry offset=""0x6e"" hidden=""true"" />
<entry offset=""0x78"" hidden=""true"" />
<entry offset=""0x79"" startLine=""31"" startColumn=""9"" endLine=""31"" endColumn=""10"" />
<entry offset=""0x7a"" startLine=""33"" startColumn=""9"" endLine=""33"" endColumn=""10"" />
<entry offset=""0x7b"" startLine=""34"" startColumn=""5"" endLine=""34"" endColumn=""6"" />
...
...
@@ -4515,8 +4520,8 @@ static void Main()
</symbols>"
);
}
[
Fact
(
Skip
=
"https://github.com/dotnet/roslyn/issues/18844"
)
,
WorkItem
(
18844
,
"https://github.com/dotnet/roslyn/issues/18844"
)]
public
void
UsingStatement_Embedded
()
[
Fact
,
WorkItem
(
18844
,
"https://github.com/dotnet/roslyn/issues/18844"
)]
public
void
UsingStatement_Embedded
Conditional
()
{
var
source
=
@"
class C
...
...
@@ -4590,6 +4595,7 @@ .maxstack 1
IL_001d: ldloc.2
IL_001e: callvirt ""void System.IDisposable.Dispose()""
IL_0023: nop
// sequence point: <hidden>
IL_0024: endfinally
}
// sequence point: return value;
...
...
@@ -4603,6 +4609,302 @@ .maxstack 1
"
,
sequencePoints
:
"C.F"
,
source
:
source
);
}
[
Fact
,
WorkItem
(
18844
,
"https://github.com/dotnet/roslyn/issues/18844"
)]
public
void
UsingStatement_EmbeddedConditional2
()
{
var
source
=
@"
class C
{
bool F()
{
bool x = true;
bool value = false;
using (var stream = new System.IO.MemoryStream())
if (x)
{
value = true;
}
else
{
value = false;
}
return value;
}
}
"
;
var
c
=
CreateCompilationWithMscorlibAndSystemCore
(
source
,
options
:
TestOptions
.
DebugDll
);
var
v
=
CompileAndVerify
(
c
);
v
.
VerifyIL
(
"C.F"
,
@"
{
// Code size 47 (0x2f)
.maxstack 1
.locals init (bool V_0, //x
bool V_1, //value
System.IO.MemoryStream V_2, //stream
bool V_3,
bool V_4)
// sequence point: {
IL_0000: nop
// sequence point: bool x = true;
IL_0001: ldc.i4.1
IL_0002: stloc.0
// sequence point: bool value = false;
IL_0003: ldc.i4.0
IL_0004: stloc.1
// sequence point: var stream = new System.IO.MemoryStream()
IL_0005: newobj ""System.IO.MemoryStream..ctor()""
IL_000a: stloc.2
.try
{
// sequence point: if (x)
IL_000b: ldloc.0
IL_000c: stloc.3
// sequence point: <hidden>
IL_000d: ldloc.3
IL_000e: brfalse.s IL_0016
// sequence point: {
IL_0010: nop
// sequence point: value = true;
IL_0011: ldc.i4.1
IL_0012: stloc.1
// sequence point: }
IL_0013: nop
IL_0014: br.s IL_001a
// sequence point: {
IL_0016: nop
// sequence point: value = false;
IL_0017: ldc.i4.0
IL_0018: stloc.1
// sequence point: }
IL_0019: nop
// sequence point: <hidden>
IL_001a: leave.s IL_0027
}
finally
{
// sequence point: <hidden>
IL_001c: ldloc.2
IL_001d: brfalse.s IL_0026
IL_001f: ldloc.2
IL_0020: callvirt ""void System.IDisposable.Dispose()""
IL_0025: nop
// sequence point: <hidden>
IL_0026: endfinally
}
// sequence point: return value;
IL_0027: ldloc.1
IL_0028: stloc.s V_4
IL_002a: br.s IL_002c
// sequence point: }
IL_002c: ldloc.s V_4
IL_002e: ret
}
"
,
sequencePoints
:
"C.F"
,
source
:
source
);
}
[
Fact
,
WorkItem
(
18844
,
"https://github.com/dotnet/roslyn/issues/18844"
)]
public
void
UsingStatement_EmbeddedWhile
()
{
var
source
=
@"
class C
{
void F(bool x)
{
using (var stream = new System.IO.MemoryStream())
while (x)
x = false;
}
}
"
;
var
c
=
CreateCompilationWithMscorlibAndSystemCore
(
source
,
options
:
TestOptions
.
DebugDll
);
var
v
=
CompileAndVerify
(
c
);
v
.
VerifyIL
(
"C.F"
,
@"
{
// Code size 31 (0x1f)
.maxstack 1
.locals init (System.IO.MemoryStream V_0, //stream
bool V_1)
// sequence point: {
IL_0000: nop
// sequence point: var stream = new System.IO.MemoryStream()
IL_0001: newobj ""System.IO.MemoryStream..ctor()""
IL_0006: stloc.0
.try
{
// sequence point: <hidden>
IL_0007: br.s IL_000c
// sequence point: x = false;
IL_0009: ldc.i4.0
IL_000a: starg.s V_1
// sequence point: while (x)
IL_000c: ldarg.1
IL_000d: stloc.1
// sequence point: <hidden>
IL_000e: ldloc.1
IL_000f: brtrue.s IL_0009
IL_0011: leave.s IL_001e
}
finally
{
// sequence point: <hidden>
IL_0013: ldloc.0
IL_0014: brfalse.s IL_001d
IL_0016: ldloc.0
IL_0017: callvirt ""void System.IDisposable.Dispose()""
IL_001c: nop
// sequence point: <hidden>
IL_001d: endfinally
}
// sequence point: }
IL_001e: ret
}
"
,
sequencePoints
:
"C.F"
,
source
:
source
);
}
[
Fact
,
WorkItem
(
18844
,
"https://github.com/dotnet/roslyn/issues/18844"
)]
public
void
UsingStatement_EmbeddedFor
()
{
var
source
=
@"
class C
{
void F(bool x)
{
using (var stream = new System.IO.MemoryStream())
for ( ; x == true; )
x = false;
}
}
"
;
var
c
=
CreateCompilationWithMscorlibAndSystemCore
(
source
,
options
:
TestOptions
.
DebugDll
);
var
v
=
CompileAndVerify
(
c
);
v
.
VerifyIL
(
"C.F"
,
@"
{
// Code size 31 (0x1f)
.maxstack 1
.locals init (System.IO.MemoryStream V_0, //stream
bool V_1)
// sequence point: {
IL_0000: nop
// sequence point: var stream = new System.IO.MemoryStream()
IL_0001: newobj ""System.IO.MemoryStream..ctor()""
IL_0006: stloc.0
.try
{
// sequence point: <hidden>
IL_0007: br.s IL_000c
// sequence point: x = false;
IL_0009: ldc.i4.0
IL_000a: starg.s V_1
// sequence point: x == true
IL_000c: ldarg.1
IL_000d: stloc.1
// sequence point: <hidden>
IL_000e: ldloc.1
IL_000f: brtrue.s IL_0009
IL_0011: leave.s IL_001e
}
finally
{
// sequence point: <hidden>
IL_0013: ldloc.0
IL_0014: brfalse.s IL_001d
IL_0016: ldloc.0
IL_0017: callvirt ""void System.IDisposable.Dispose()""
IL_001c: nop
// sequence point: <hidden>
IL_001d: endfinally
}
// sequence point: }
IL_001e: ret
}
"
,
sequencePoints
:
"C.F"
,
source
:
source
);
}
[
Fact
,
WorkItem
(
18844
,
"https://github.com/dotnet/roslyn/issues/18844"
)]
public
void
LockStatement_EmbeddedIf
()
{
var
source
=
@"
class C
{
void F(bool x)
{
string y = """";
lock (y)
if (!x)
System.Console.Write(1);
else
System.Console.Write(2);
}
}
"
;
var
c
=
CreateCompilationWithMscorlibAndSystemCore
(
source
,
options
:
TestOptions
.
DebugDll
);
var
v
=
CompileAndVerify
(
c
);
v
.
VerifyIL
(
"C.F"
,
@"
{
// Code size 58 (0x3a)
.maxstack 2
.locals init (string V_0, //y
string V_1,
bool V_2,
bool V_3)
// sequence point: {
IL_0000: nop
// sequence point: string y = """";
IL_0001: ldstr """"
IL_0006: stloc.0
// sequence point: lock (y)
IL_0007: ldloc.0
IL_0008: stloc.1
IL_0009: ldc.i4.0
IL_000a: stloc.2
.try
{
IL_000b: ldloc.1
IL_000c: ldloca.s V_2
IL_000e: call ""void System.Threading.Monitor.Enter(object, ref bool)""
IL_0013: nop
// sequence point: if (!x)
IL_0014: ldarg.1
IL_0015: ldc.i4.0
IL_0016: ceq
IL_0018: stloc.3
// sequence point: <hidden>
IL_0019: ldloc.3
IL_001a: brfalse.s IL_0025
// sequence point: System.Console.Write(1);
IL_001c: ldc.i4.1
IL_001d: call ""void System.Console.Write(int)""
IL_0022: nop
IL_0023: br.s IL_002c
// sequence point: System.Console.Write(2);
IL_0025: ldc.i4.2
IL_0026: call ""void System.Console.Write(int)""
IL_002b: nop
// sequence point: <hidden>
IL_002c: leave.s IL_0039
}
finally
{
// sequence point: <hidden>
IL_002e: ldloc.2
IL_002f: brfalse.s IL_0038
IL_0031: ldloc.1
IL_0032: call ""void System.Threading.Monitor.Exit(object)""
IL_0037: nop
// sequence point: <hidden>
IL_0038: endfinally
}
// sequence point: }
IL_0039: ret
}
"
,
sequencePoints
:
"C.F"
,
source
:
source
);
}
#
endregion
// LockStatement tested in CodeGenLock
...
...
@@ -5986,7 +6288,6 @@ static async Task F()
<entry offset=""0x7"" startLine=""6"" startColumn=""5"" endLine=""6"" endColumn=""6"" />
<entry offset=""0x8"" startLine=""7"" startColumn=""9"" endLine=""7"" endColumn=""35"" />
<entry offset=""0x1f"" startLine=""8"" startColumn=""9"" endLine=""8"" endColumn=""26"" />
<entry offset=""0x4a"" hidden=""true"" />
<entry offset=""0x4c"" hidden=""true"" />
<entry offset=""0x64"" startLine=""9"" startColumn=""5"" endLine=""9"" endColumn=""6"" />
<entry offset=""0x6c"" hidden=""true"" />
...
...
@@ -6049,7 +6350,6 @@ static void M()
<entry offset=""0x7"" startLine=""7"" startColumn=""9"" endLine=""7"" endColumn=""10"" />
<entry offset=""0x8"" startLine=""8"" startColumn=""13"" endLine=""8"" endColumn=""39"" />
<entry offset=""0x1f"" startLine=""9"" startColumn=""13"" endLine=""9"" endColumn=""30"" />
<entry offset=""0x4a"" hidden=""true"" />
<entry offset=""0x4c"" hidden=""true"" />
<entry offset=""0x64"" startLine=""10"" startColumn=""9"" endLine=""10"" endColumn=""10"" />
<entry offset=""0x6c"" hidden=""true"" />
...
...
@@ -6367,7 +6667,6 @@ public async void M1()
<sequencePoints>
<entry offset=""0x0"" hidden=""true"" document=""1"" />
<entry offset=""0x7"" startLine=""8"" startColumn=""5"" endLine=""8"" endColumn=""6"" document=""1"" />
<entry offset=""0x8"" hidden=""true"" document=""1"" />
<entry offset=""0xa"" hidden=""true"" document=""1"" />
<entry offset=""0x22"" startLine=""9"" startColumn=""5"" endLine=""9"" endColumn=""6"" document=""1"" />
<entry offset=""0x2a"" hidden=""true"" document=""1"" />
...
...
@@ -6743,7 +7042,6 @@ .maxstack 2
IL_001a: br.s IL_001e
// sequence point: break;
IL_001c: br.s IL_001e
// sequence point: <hidden>
IL_001e: leave.s IL_0038
}
catch System.Exception
...
...
@@ -6826,7 +7124,6 @@ .maxstack 2
// sequence point: <hidden>
IL_0021: ldloc.1
IL_0022: brtrue.s IL_0011
// sequence point: <hidden>
IL_0024: leave.s IL_003e
}
catch System.Exception
...
...
@@ -6918,7 +7215,6 @@ .maxstack 3
// sequence point: <hidden>
IL_0031: ldloc.2
IL_0032: brtrue.s IL_0011
// sequence point: <hidden>
IL_0034: leave.s IL_004e
}
catch System.Exception
...
...
@@ -7013,7 +7309,6 @@ .maxstack 3
// sequence point: <hidden>
IL_003b: ldloc.2
IL_003c: brtrue.s IL_001b
// sequence point: <hidden>
IL_003e: leave.s IL_0058
}
catch System.Exception
...
...
src/Compilers/CSharp/Test/Emit/PDB/PDBTupleTests.cs
浏览文件 @
683a457b
...
...
@@ -251,6 +251,7 @@ static void F(System.Collections.Generic.IEnumerable<(int a, int b)> ie)
<entry offset=""0x21"" startLine=""10"" startColumn=""9"" endLine=""10"" endColumn=""10"" />
<entry offset=""0x22"" startLine=""7"" startColumn=""13"" endLine=""7"" endColumn=""15"" />
<entry offset=""0x2c"" hidden=""true"" />
<entry offset=""0x36"" hidden=""true"" />
<entry offset=""0x37"" startLine=""11"" startColumn=""5"" endLine=""11"" endColumn=""6"" />
</sequencePoints>
<scope startOffset=""0x0"" endOffset=""0x38"">
...
...
src/Compilers/CSharp/Test/Emit/PDB/PDBUsingTests.cs
浏览文件 @
683a457b
...
...
@@ -1734,7 +1734,7 @@ .locals init (Test V_0)
IL_000e: ldloc.0
IL_000f: callvirt ""void System.IDisposable.Dispose()""
IL_0014: nop
IL_0015: endfinally
~
IL_0015: endfinally
}
-IL_0016: ret
}"
,
sequencePoints
:
"Test.Main"
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录