Imported Upstream version 6.12.0.86

Former-commit-id: 7a84ce7d08c42c458ac8e74b27186ca863315d79
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2020-07-10 08:44:59 +00:00
parent 92747312ea
commit 0b380204a4
812 changed files with 26901 additions and 9053 deletions

View File

@@ -229,6 +229,16 @@ namespace Mono.Cecil.Cil {
instructions.Insert (index + 1, instruction);
}
public void InsertAfter (int index, Instruction instruction)
{
if (index < 0 || index >= instructions.Count)
throw new ArgumentOutOfRangeException ("index");
if (instruction == null)
throw new ArgumentNullException ("instruction");
instructions.Insert (index + 1, instruction);
}
public void Append (Instruction instruction)
{
if (instruction == null)
@@ -248,6 +258,15 @@ namespace Mono.Cecil.Cil {
Remove (target);
}
public void Replace (int index, Instruction instruction)
{
if (instruction == null)
throw new ArgumentNullException ("instruction");
InsertAfter (index, instruction);
RemoveAt (index);
}
public void Remove (Instruction instruction)
{
if (instruction == null)
@@ -256,5 +275,13 @@ namespace Mono.Cecil.Cil {
if (!instructions.Remove (instruction))
throw new ArgumentOutOfRangeException ("instruction");
}
public void RemoveAt (int index)
{
if (index < 0 || index >= instructions.Count)
throw new ArgumentOutOfRangeException ("index");
instructions.RemoveAt (index);
}
}
}

View File

@@ -92,7 +92,7 @@ namespace Mono.Cecil.Cil {
var parameter_type = method.DeclaringType as TypeReference;
if (parameter_type.HasGenericParameters) {
var instance = new GenericInstanceType (parameter_type);
var instance = new GenericInstanceType (parameter_type, parameter_type.GenericParameters.Count);
for (int i = 0; i < parameter_type.GenericParameters.Count; i++)
instance.GenericArguments.Add (parameter_type.GenericParameters [i]);