X-Git-Url: https://gitweb.ps.run/toc/blobdiff_plain/9f94b672a5dc32da5ad01742bd4e976315a30d9c..HEAD:/src/visit.h diff --git a/src/visit.h b/src/visit.h index 646ac61..279a4fc 100644 --- a/src/visit.h +++ b/src/visit.h @@ -8,17 +8,17 @@ // tree can be walked selectively by providing only // needed callbacks struct Visitor { - std::function ctx)> onType = [](auto, auto){}; - std::function ctx)> onExpr = [](auto, auto){}; - std::function ctx)> onStmt = [](auto, auto){}; - std::function ctx)> onBody = [](auto, auto){}; - std::function ctx)> onFunction = [](auto, auto){}; - std::function ctx)> onVariable = [](auto, auto){}; + std::function ctx)> onType = [](auto, auto){}; + std::function ctx)> onExpr = [](auto, auto){}; + std::function ctx)> onStmt = [](auto, auto){}; + std::function ctx)> onBody = [](auto, auto){}; + std::function ctx)> onFunction = [](auto, auto){}; + std::function ctx)> onVariable = [](auto, auto){}; std::function &, const std::shared_ptr ctx)> onStructMethod = [](auto, auto){}; std::function &, const std::shared_ptr ctx)> onStructMember = [](auto, auto){}; - std::function ctx)> onStruct = [](auto, auto){}; - std::function ctx)> onNamespace = [](auto, auto){}; - std::function ctx)> onProgram = [](auto, auto){}; + std::function ctx)> onStruct = [](auto, auto){}; + std::function ctx)> onNamespace = [](auto, auto){}; + std::function ctx)> onProgram = [](auto, auto){}; }; #define VISIT(XS) for (auto x : XS) visit(x); @@ -162,9 +162,9 @@ public: v.onFunction(x, ctx); if (x.defined) { - visit(x.body); for (auto v : x.parameters) visit(v.type); + visit(x.body); } } void visit(const StructMember & x)