Exemplo n.º 1
0
        [NotNull] public static IMutableControlFlowGraph Modify([NotNull] this IControlFlowGraph input, [NotNull] Action <IEdge, Action <IBasicBlock, IBasicBlock, EdgeType> > copy)
        {
            var cfg = new ControlFlowGraph();

            // Copy vertices
            var replacementVertices = input.CloneVertices(cfg, __ => true);

            // Copy edges
            foreach (var edge in input.Edges)
            {
                copy(edge, (s, e, t) => {
                    var ss = replacementVertices[s];
                    var ee = replacementVertices[e];
                    cfg.CreateEdge(ss, ee, t);
                });
            }

            return(cfg);
        }