Browse Source

Merge pull request #3417 from icsharpcode/roslyn413

Roslyn 4.13
pull/3427/head
Siegfried Pammer 5 months ago
committed by GitHub
parent
commit
412b5134e7
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 4
      Directory.Packages.props
  2. 29
      ICSharpCode.Decompiler/IL/ControlFlow/StateRangeAnalysis.cs

4
Directory.Packages.props

@ -15,8 +15,8 @@
<PackageVersion Include="K4os.Compression.LZ4" Version="1.3.8" />
<PackageVersion Include="McMaster.Extensions.CommandLineUtils" Version="4.1.1" />
<PackageVersion Include="McMaster.Extensions.Hosting.CommandLine" Version="4.1.1" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.12.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.VisualBasic" Version="4.12.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.13.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.VisualBasic" Version="4.13.0" />
<PackageVersion Include="Microsoft.DiaSymReader.Converter.Xml" Version="1.1.0-beta2-22171-02" />
<PackageVersion Include="Microsoft.DiaSymReader" Version="1.4.0" />
<PackageVersion Include="Microsoft.DiaSymReader.Native" Version="17.0.0-beta1.21524.1" />

29
ICSharpCode.Decompiler/IL/ControlFlow/StateRangeAnalysis.cs

@ -21,11 +21,8 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using ICSharpCode.Decompiler.TypeSystem;
using ICSharpCode.Decompiler.Util;
@ -225,6 +222,32 @@ namespace ICSharpCode.Decompiler.IL.ControlFlow
goto default;
}
}
case StObj stobj when mode == StateRangeAnalysisMode.IteratorDispose:
{
if (stobj.MatchStFld(out var target, out var field, out var value) && target.MatchLdThis())
{
if (field.MemberDefinition == stateField && value.MatchLdcI4(-2))
{
// Roslyn 4.13 sets the state field in Dispose() to mark the iterator as disposed,
// don't consider this user code.
return stateRange;
}
else if (value.MatchDefaultOrNullOrZero())
{
// Roslyn 4.13 clears any local hoisted local variables in Dispose(),
// don't consider this user code.
return stateRange;
}
else
{
goto default;
}
}
else
{
goto default;
}
}
default:
// User code - abort analysis
if (mode == StateRangeAnalysisMode.IteratorDispose && !(inst is Leave l && l.IsLeavingFunction))

Loading…
Cancel
Save