.NET Decompiler with support for PDB generation, ReadyToRun, Metadata (&more) - cross-platform!
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

33 lines
830 B

#nullable enable
using System;
using System.Collections.Generic;
using System.Text;
using ICSharpCode.Decompiler.Util;
namespace ICSharpCode.Decompiler.IL
{
internal static class ILInstructionExtensions
{
public static T WithILRange<T>(this T target, ILInstruction sourceInstruction) where T : ILInstruction
{
target.AddILRange(sourceInstruction);
return target;
}
public static T WithILRange<T>(this T target, Interval range) where T : ILInstruction
{
target.AddILRange(range);
return target;
}
public static ILInstruction? GetNextSibling(this ILInstruction? instruction)
{
if (instruction?.Parent == null)
return null;
if (instruction.ChildIndex + 1 >= instruction.Parent.Children.Count)
return null;
return instruction.Parent.Children[instruction.ChildIndex + 1];
}
}
}