diff --git a/ICSharpCode.Decompiler/IL/Instructions.cs b/ICSharpCode.Decompiler/IL/Instructions.cs index 86e73f797..4e6bf709b 100644 --- a/ICSharpCode.Decompiler/IL/Instructions.cs +++ b/ICSharpCode.Decompiler/IL/Instructions.cs @@ -843,7 +843,7 @@ namespace ICSharpCode.Decompiler.IL protected internal override bool PerformMatch(ILInstruction other, ref Patterns.Match match) { var o = other as CompoundAssignmentInstruction; - return o != null && this.target.PerformMatch(o.target, ref match) && this.value.PerformMatch(o.value, ref match); + return o != null && this.target.PerformMatch(o.target, ref match) && this.value.PerformMatch(o.value, ref match) && type.Equals(o.type); } } @@ -2765,7 +2765,7 @@ namespace ICSharpCode.Decompiler.IL protected internal override bool PerformMatch(ILInstruction other, ref Patterns.Match match) { var o = other as NewArr; - return o != null && type.Equals(o.type); + return o != null && type.Equals(o.type) && Patterns.ListMatch.DoMatch(this.Indices, o.Indices, ref match); } } @@ -3073,7 +3073,7 @@ namespace ICSharpCode.Decompiler.IL protected internal override bool PerformMatch(ILInstruction other, ref Patterns.Match match) { var o = other as LdElema; - return o != null && type.Equals(o.type) && this.array.PerformMatch(o.array, ref match) && IsReadOnly == o.IsReadOnly; + return o != null && type.Equals(o.type) && this.array.PerformMatch(o.array, ref match) && Patterns.ListMatch.DoMatch(this.Indices, o.Indices, ref match) && IsReadOnly == o.IsReadOnly; } } diff --git a/ICSharpCode.Decompiler/IL/Instructions.tt b/ICSharpCode.Decompiler/IL/Instructions.tt index 8fb2a65ee..5d1186216 100644 --- a/ICSharpCode.Decompiler/IL/Instructions.tt +++ b/ICSharpCode.Decompiler/IL/Instructions.tt @@ -631,6 +631,7 @@ namespace ICSharpCode.Decompiler.IL opCode.ConstructorParameters.Add("params ILInstruction[] " + arg); opCode.ConstructorBody.Add("this." + argProp + " = new InstructionCollection(this, " + i + ");"); opCode.ConstructorBody.Add("this." + argProp + ".AddRange(" + arg + ");"); + opCode.PerformMatchConditions.Add("Patterns.ListMatch.DoMatch(this." + argProp + ", o." + argProp + ", ref match)"); if (i == 0) opCode.WriteArguments.Add("bool first = true;"); opCode.WriteArguments.Add("foreach (var " + arg + " in " + argProp + ") {");