|
|
@ -153,7 +153,7 @@ namespace ICSharpCode.Decompiler.CSharp |
|
|
|
switch (section.Body) { |
|
|
|
switch (section.Body) { |
|
|
|
case Branch br: |
|
|
|
case Branch br: |
|
|
|
// we can only inline the block, if all branches are in the switchContainer.
|
|
|
|
// we can only inline the block, if all branches are in the switchContainer.
|
|
|
|
if (br.TargetBlock.Parent == switchContainer && switchContainer.Descendants.OfType<Branch>().Where(b => b.TargetBlock == br.TargetBlock).All(b => BlockContainer.FindClosestContainer(b) == switchContainer)) |
|
|
|
if (br.TargetBlock.Parent == switchContainer && switchContainer.Descendants.OfType<Branch>().Where(b => b.TargetBlock == br.TargetBlock).All(b => BlockContainer.FindClosestSwitchContainer(b) == switchContainer)) |
|
|
|
caseLabelMapping.Add(br.TargetBlock, firstValueResolveResult); |
|
|
|
caseLabelMapping.Add(br.TargetBlock, firstValueResolveResult); |
|
|
|
break; |
|
|
|
break; |
|
|
|
default: |
|
|
|
default: |
|
|
@ -167,7 +167,7 @@ namespace ICSharpCode.Decompiler.CSharp |
|
|
|
switch (section.Body) { |
|
|
|
switch (section.Body) { |
|
|
|
case Branch br: |
|
|
|
case Branch br: |
|
|
|
// we can only inline the block, if all branches are in the switchContainer.
|
|
|
|
// we can only inline the block, if all branches are in the switchContainer.
|
|
|
|
if (br.TargetBlock.Parent == switchContainer && switchContainer.Descendants.OfType<Branch>().Where(b => b.TargetBlock == br.TargetBlock).All(b => BlockContainer.FindClosestContainer(b) == switchContainer)) |
|
|
|
if (br.TargetBlock.Parent == switchContainer && switchContainer.Descendants.OfType<Branch>().Where(b => b.TargetBlock == br.TargetBlock).All(b => BlockContainer.FindClosestSwitchContainer(b) == switchContainer)) |
|
|
|
ConvertSwitchSectionBody(astSection, br.TargetBlock); |
|
|
|
ConvertSwitchSectionBody(astSection, br.TargetBlock); |
|
|
|
else |
|
|
|
else |
|
|
|
ConvertSwitchSectionBody(astSection, section.Body); |
|
|
|
ConvertSwitchSectionBody(astSection, section.Body); |
|
|
|