Browse Source

#2109: Skip id ranges with no events

pull/2145/head
Siegfried Pammer 5 years ago
parent
commit
19719ee1fb
  1. 11
      ILSpy.BamlDecompiler/Rewrite/ConnectionIdRewritePass.cs

11
ILSpy.BamlDecompiler/Rewrite/ConnectionIdRewritePass.cs

@ -139,15 +139,19 @@ namespace ILSpy.BamlDecompiler.Rewrite @@ -139,15 +139,19 @@ namespace ILSpy.BamlDecompiler.Rewrite
var block = function.Body.Children.OfType<Block>().First();
var ilSwitch = block.Descendants.OfType<SwitchInstruction>().FirstOrDefault();
var events = new List<EventRegistration>();
if (ilSwitch != null)
{
foreach (var section in ilSwitch.Sections)
{
var events = new List<EventRegistration>();
events.Clear();
FindEvents(section.Body, events);
if (events.Count > 0)
{
result.Add((section.Labels, events.ToArray()));
}
}
}
else
{
foreach (var ifInst in function.Descendants.OfType<IfInstruction>())
@ -161,12 +165,15 @@ namespace ILSpy.BamlDecompiler.Rewrite @@ -161,12 +165,15 @@ namespace ILSpy.BamlDecompiler.Rewrite
var inst = comp.Kind == ComparisonKind.Inequality
? ifInst.FalseInst
: ifInst.TrueInst;
var events = new List<EventRegistration>();
events.Clear();
FindEvents(inst, events);
if (events.Count > 0)
{
result.Add((new LongSet(id), events.ToArray()));
}
}
}
}
void FindEvents(ILInstruction inst, List<EventRegistration> events)
{

Loading…
Cancel
Save