mirror of
https://github.com/AssetRipper/ILSpy.git
synced 2026-11-13 20:05:48 -10:00
34 lines
830 B
C#
34 lines
830 B
C#
#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];
|
|
}
|
|
}
|
|
}
|