diff options
Diffstat (limited to 'src/visit.h')
| -rw-r--r-- | src/visit.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/visit.h b/src/visit.h index 1175a86..646ac61 100644 --- a/src/visit.h +++ b/src/visit.h @@ -4,6 +4,9 @@ #include <functional>
+// struct with callback functions for all relevant types
+// tree can be walked selectively by providing only
+// needed callbacks
struct Visitor {
std::function<void(const Type &, const std::shared_ptr<Context> ctx)> onType = [](auto, auto){};
std::function<void(const Expr &, const std::shared_ptr<Context> ctx)> onExpr = [](auto, auto){};
@@ -20,6 +23,7 @@ struct Visitor { #define VISIT(XS) for (auto x : XS) visit(x);
+// simply walk IR by recursively calling functions for all children
struct Visit {
private:
Visitor v;
|
