diff --git a/ICSharpCode.Decompiler/IL/Transforms/TransformArrayInitializers.cs b/ICSharpCode.Decompiler/IL/Transforms/TransformArrayInitializers.cs index 522e4db36..4503692fc 100644 --- a/ICSharpCode.Decompiler/IL/Transforms/TransformArrayInitializers.cs +++ b/ICSharpCode.Decompiler/IL/Transforms/TransformArrayInitializers.cs @@ -186,7 +186,7 @@ namespace ICSharpCode.Decompiler.IL.Transforms IType type; if (index >= length) break; - if (!block.Instructions[i].MatchStObj(out target, out value, out type) || !IsPrimitiveValue(value)) + if (!block.Instructions[i].MatchStObj(out target, out value, out type) || value.Descendants.OfType().Any(inst => inst.Variable == store)) return false; var ldelem = target as LdElema; if (ldelem == null || !ldelem.Array.MatchLdLoc(store) || ldelem.Indices.Count != 1 || !ldelem.Indices[0].MatchLdcI4(out index)) @@ -205,21 +205,6 @@ namespace ICSharpCode.Decompiler.IL.Transforms } return true; } - - bool IsPrimitiveValue(ILInstruction value) - { - switch (value.OpCode) { - case OpCode.LdLoc: - case OpCode.LdNull: - case OpCode.LdcI4: - case OpCode.LdcI8: - case OpCode.LdcF: - case OpCode.LdcDecimal: - return true; - default: - return false; - } - } bool HandleJaggedArrayInitializer(Block block, int pos, ILVariable store, int length, out ILVariable finalStore, out ILInstruction[] values, out int instructionsToRemove) {