Commit 4c42a46d authored by Paul's avatar Paul
Browse files

Add the program to the matcher callback

parent b8a7d3bb
...@@ -217,7 +217,7 @@ void find_matches(program& p, Ms&&... ms) ...@@ -217,7 +217,7 @@ void find_matches(program& p, Ms&&... ms)
auto r = match_instruction(p, ins, m.matcher()); auto r = match_instruction(p, ins, m.matcher());
if(r.result == p.end()) if(r.result == p.end())
return; return;
m.apply(r); m.apply(p, r);
match = true; match = true;
}, },
ms...); ms...);
......
...@@ -355,7 +355,7 @@ struct match_find_sum ...@@ -355,7 +355,7 @@ struct match_find_sum
migraph::instruction_ref ins; migraph::instruction_ref ins;
auto matcher() const { return matchers::name("sum"); } auto matcher() const { return matchers::name("sum"); }
void apply(matchers::matcher_result r) const { EXPECT(bool{r.result == ins}); } void apply(migraph::program&, matchers::matcher_result r) const { EXPECT(bool{r.result == ins}); }
}; };
struct match_find_literal struct match_find_literal
...@@ -363,7 +363,7 @@ struct match_find_literal ...@@ -363,7 +363,7 @@ struct match_find_literal
migraph::instruction_ref ins; migraph::instruction_ref ins;
auto matcher() const { return matchers::name("@literal"); } auto matcher() const { return matchers::name("@literal"); }
void apply(matchers::matcher_result r) const void apply(migraph::program&, matchers::matcher_result r) const
{ {
EXPECT(bool{r.result != ins}); EXPECT(bool{r.result != ins});
EXPECT(r.result->name() == "@literal"); EXPECT(r.result->name() == "@literal");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment