From 66a27d2fc7c1ad4e97de76d4982168a0fed9920a Mon Sep 17 00:00:00 2001 From: Patrick Schönberger Date: Thu, 12 Aug 2021 10:32:51 +0200 Subject: comments --- src/visit.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/visit.h') 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 +// struct with callback functions for all relevant types +// tree can be walked selectively by providing only +// needed callbacks struct Visitor { std::function ctx)> onType = [](auto, auto){}; std::function 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; -- cgit v1.2.3