diff options
| author | Patrick Schönberger | 2021-08-14 14:56:12 +0200 |
|---|---|---|
| committer | Patrick Schönberger | 2021-08-14 14:56:12 +0200 |
| commit | c6ad2948bb98d42f8e0883ef82cd14cd2d5eda60 (patch) | |
| tree | 9e83d6d8f61e56f5d3425b8709314d6bdb9315a9 /src/visit.h | |
| parent | 9f94b672a5dc32da5ad01742bd4e976315a30d9c (diff) | |
| download | toc-main.tar.gz toc-main.zip | |
Diffstat (limited to 'src/visit.h')
| -rw-r--r-- | src/visit.h | 20 |
1 files changed, 10 insertions, 10 deletions
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<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){};
- std::function<void(const Stmt &, const std::shared_ptr<Context> ctx)> onStmt = [](auto, auto){};
- std::function<void(const Body &, const std::shared_ptr<Context> ctx)> onBody = [](auto, auto){};
- std::function<void(const Function &, const std::shared_ptr<Context> ctx)> onFunction = [](auto, auto){};
- std::function<void(const Variable &, const std::shared_ptr<Context> ctx)> onVariable = [](auto, auto){};
+ 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){};
+ std::function<void(const Stmt &, const std::shared_ptr<Context> ctx)> onStmt = [](auto, auto){};
+ std::function<void(const Body &, const std::shared_ptr<Context> ctx)> onBody = [](auto, auto){};
+ std::function<void(const Function &, const std::shared_ptr<Context> ctx)> onFunction = [](auto, auto){};
+ std::function<void(const Variable &, const std::shared_ptr<Context> ctx)> onVariable = [](auto, auto){};
std::function<void(const StructMember<Function> &, const std::shared_ptr<Context> ctx)> onStructMethod = [](auto, auto){};
std::function<void(const StructMember<Variable> &, const std::shared_ptr<Context> ctx)> onStructMember = [](auto, auto){};
- std::function<void(const Struct &, const std::shared_ptr<Context> ctx)> onStruct = [](auto, auto){};
- std::function<void(const Namespace &, const std::shared_ptr<Context> ctx)> onNamespace = [](auto, auto){};
- std::function<void(const Program &, const std::shared_ptr<Context> ctx)> onProgram = [](auto, auto){};
+ std::function<void(const Struct &, const std::shared_ptr<Context> ctx)> onStruct = [](auto, auto){};
+ std::function<void(const Namespace &, const std::shared_ptr<Context> ctx)> onNamespace = [](auto, auto){};
+ std::function<void(const Program &, const std::shared_ptr<Context> 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<Function> & x)
|
