Browse Source

Add missing DoMatch call for collection members

pull/728/merge
Daniel Grunwald 9 years ago
parent
commit
00b017778c
  1. 6
      ICSharpCode.Decompiler/IL/Instructions.cs
  2. 1
      ICSharpCode.Decompiler/IL/Instructions.tt

6
ICSharpCode.Decompiler/IL/Instructions.cs

@ -843,7 +843,7 @@ namespace ICSharpCode.Decompiler.IL
protected internal override bool PerformMatch(ILInstruction other, ref Patterns.Match match) protected internal override bool PerformMatch(ILInstruction other, ref Patterns.Match match)
{ {
var o = other as CompoundAssignmentInstruction; 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) protected internal override bool PerformMatch(ILInstruction other, ref Patterns.Match match)
{ {
var o = other as NewArr; 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) protected internal override bool PerformMatch(ILInstruction other, ref Patterns.Match match)
{ {
var o = other as LdElema; 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;
} }
} }

1
ICSharpCode.Decompiler/IL/Instructions.tt

@ -631,6 +631,7 @@ namespace ICSharpCode.Decompiler.IL
opCode.ConstructorParameters.Add("params ILInstruction[] " + arg); opCode.ConstructorParameters.Add("params ILInstruction[] " + arg);
opCode.ConstructorBody.Add("this." + argProp + " = new InstructionCollection<ILInstruction>(this, " + i + ");"); opCode.ConstructorBody.Add("this." + argProp + " = new InstructionCollection<ILInstruction>(this, " + i + ");");
opCode.ConstructorBody.Add("this." + argProp + ".AddRange(" + arg + ");"); opCode.ConstructorBody.Add("this." + argProp + ".AddRange(" + arg + ");");
opCode.PerformMatchConditions.Add("Patterns.ListMatch.DoMatch(this." + argProp + ", o." + argProp + ", ref match)");
if (i == 0) if (i == 0)
opCode.WriteArguments.Add("bool first = true;"); opCode.WriteArguments.Add("bool first = true;");
opCode.WriteArguments.Add("foreach (var " + arg + " in " + argProp + ") {"); opCode.WriteArguments.Add("foreach (var " + arg + " in " + argProp + ") {");

Loading…
Cancel
Save