Browse Source

Use pattern matching

pull/3554/head
ds5678 4 months ago
parent
commit
b2ca674b84
  1. 4
      ICSharpCode.Decompiler/IL/Transforms/TransformCollectionAndObjectInitializers.cs

4
ICSharpCode.Decompiler/IL/Transforms/TransformCollectionAndObjectInitializers.cs

@ -98,9 +98,9 @@ namespace ICSharpCode.Decompiler.IL.Transforms @@ -98,9 +98,9 @@ namespace ICSharpCode.Decompiler.IL.Transforms
return;
}
// Copy-propagate stack slot holding an 'ldloca' of the variable
if (pos < block.Instructions.Count && block.Instructions[pos + 1] is StLoc { Variable: { Kind: VariableKind.StackSlot, IsSingleDefinition: true }, Value: LdLoca ldLoca } && ldLoca.Variable == v)
if (pos < block.Instructions.Count && block.Instructions[pos + 1] is StLoc { Variable: { Kind: VariableKind.StackSlot, IsSingleDefinition: true }, Value: LdLoca ldLoca } stLocStack && ldLoca.Variable == v)
{
CopyPropagation.Propagate((StLoc)block.Instructions[pos + 1], context);
CopyPropagation.Propagate(stLocStack, context);
}
int initializerItemsCount = 0;
bool initializerContainsInitOnlyItems = false;

Loading…
Cancel
Save