mirror of
https://github.com/Colton1skees/Dna
synced 2026-06-21 13:42:09 +00:00
32 lines
837 B
C#
32 lines
837 B
C#
using Dna.ControlFlow;
|
|
using Rivers;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Dna.Extensions
|
|
{
|
|
public static class ControlFlowExtensions
|
|
{
|
|
public static BasicBlock<T> GetBlock<T>(this Node node)
|
|
{
|
|
return (BasicBlock<T>)node.UserData.Values.First();
|
|
}
|
|
|
|
public static void SetBlock<T>(this Node node, BasicBlock<T> block)
|
|
{
|
|
node.UserData.Clear();
|
|
node.UserData.Add(block.Address.ToString("X"), block);
|
|
}
|
|
|
|
public static BlockEdge<T> ToBlockEdge<T>(this Edge edge)
|
|
{
|
|
var source = (BasicBlock<T>)edge.Source;
|
|
var target = (BasicBlock<T>)edge.Target;
|
|
return new BlockEdge<T>(source, target);
|
|
}
|
|
}
|
|
}
|