Browse Source

#2109: Skip id ranges with no events

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

15
ILSpy.BamlDecompiler/Rewrite/ConnectionIdRewritePass.cs

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

Loading…
Cancel
Save