diff --git a/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_IfStatement.cs b/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_IfStatement.cs index 0c807fc1072f1508cbcf30ea4ff70362fed2274c..2305c3e63d7189eff3815f1d37449f67b145d47c 100644 --- a/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_IfStatement.cs +++ b/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_IfStatement.cs @@ -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); } diff --git a/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_ReturnStatement.cs b/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_ReturnStatement.cs index a611dffde4a0a37fcfc32ce8876d5780e687f16a..18b2442dbe4a79500a95585eed02f4ceb2893ed9 100644 --- a/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_ReturnStatement.cs +++ b/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_ReturnStatement.cs @@ -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; } diff --git a/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenLockTests.cs b/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenLockTests.cs index 6a0f3d1eeba359536c89697c955053e17f94e53f..7bca136e11e92aa9b722d206b92c99d582f2d326 100644 --- a/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenLockTests.cs +++ b/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenLockTests.cs @@ -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)"" diff --git a/src/Compilers/CSharp/Test/Emit/Emit/EditAndContinue/LocalSlotMappingTests.cs b/src/Compilers/CSharp/Test/Emit/Emit/EditAndContinue/LocalSlotMappingTests.cs index 7dce777325afd66661bb3c09e8b5414ea4ecea66..2ceeac1661b2fea050acc7e7e8ea6ef0b3e8f082 100644 --- a/src/Compilers/CSharp/Test/Emit/Emit/EditAndContinue/LocalSlotMappingTests.cs +++ b/src/Compilers/CSharp/Test/Emit/Emit/EditAndContinue/LocalSlotMappingTests.cs @@ -349,10 +349,12 @@ static void M()