From d89cf2f69961f402c94848edc7e2ed89fd6230cb Mon Sep 17 00:00:00 2001 From: Alex Coyte Date: Fri, 6 Jan 2017 09:12:22 +1100 Subject: [PATCH] tidy --- src/rose/rose_build_add.cpp | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/src/rose/rose_build_add.cpp b/src/rose/rose_build_add.cpp index 3ac6836f..68cc67a1 100644 --- a/src/rose/rose_build_add.cpp +++ b/src/rose/rose_build_add.cpp @@ -1031,14 +1031,8 @@ bool empty(const GraphT &g) { } static -bool canImplementGraph(const RoseInGraph &in, NGHolder &h, - const vector &edges, bool prefilter, - const ReportManager &rm, const CompileContext &cc) { - assert(!edges.empty()); - assert(&*in[edges[0]].graph == &h); - - assert(h.kind == whatRoseIsThis(in, edges[0])); - +bool canImplementGraph(NGHolder &h, bool prefilter, const ReportManager &rm, + const CompileContext &cc) { if (isImplementableNFA(h, &rm, cc)) { return true; } @@ -1561,11 +1555,10 @@ bool RoseBuildImpl::addRose(const RoseInGraph &ig, bool prefilter) { vector graph_edges; for (auto h : ordered_graphs) { - const vector &h_edges = graphs.at(h); - if (!canImplementGraph(in, *h, h_edges, prefilter, rm, cc)) { + if (!canImplementGraph(*h, prefilter, rm, cc)) { return false; } - insert(&graph_edges, graph_edges.end(), h_edges); + insert(&graph_edges, graph_edges.end(), graphs[h]); } /* we are now past the point of no return. We can start making irreversible @@ -1623,7 +1616,7 @@ bool roseCheckRose(const RoseInGraph &ig, bool prefilter, return false; } - map> graphs; + vector graphs; for (const auto &e : edges_range(ig)) { if (!ig[e].graph) { @@ -1635,11 +1628,11 @@ bool roseCheckRose(const RoseInGraph &ig, bool prefilter, continue; } - graphs[ig[e].graph.get()].push_back(e); + graphs.push_back(ig[e].graph.get()); } - for (const auto &m : graphs) { - if (!canImplementGraph(ig, *m.first, m.second, prefilter, rm, cc)) { + for (const auto &g : graphs) { + if (!canImplementGraph(*g, prefilter, rm, cc)) { return false; } }