Loading...
Searching...
No Matches
macro.hpp
Go to the documentation of this file.
1
2#pragma once
3
5
6namespace by {
7
8 class stelaVisitor;
9 class stelaVisitInfo;
10} // namespace by
11
12// ACCEPT for stela AST.
13// Same macro names as byeol core (VISIT / DEF_VISIT), but bound to stelaVisitor
14// and stelaVisitInfo. byeol undefines these in its own metaExtension header and
15// redefines them to bind to its own visitor. Since include order for the two
16// AST hierarchies never crosses (stela cannot see byeol), the two definitions
17// never collide within one translation unit's AST body.
18#define __BY__DECL_VISIT_0() __BY__DECL_VISIT_1(super)
19#define __BY__DECL_VISIT_1(SUPER) \
20public: \
21 using SUPER::accept; \
22 void accept(const stelaVisitInfo& i, stelaVisitor& v) override; \
23 \
24private:
25#define __BY__DECL_VISIT(...) BY_OVERLOAD(__BY__DECL_VISIT, __VA_ARGS__)
26
27#define __BY__DECL_DEF_VISIT_0() __BY__DECL_DEF_VISIT_1(me)
28#define __BY__DECL_DEF_VISIT_1(ME) \
29 void ME::accept(const stelaVisitInfo& i, stelaVisitor& v) { v.visit(i, *this); }
30#define __BY__DECL_DEF_VISIT(...) BY_OVERLOAD(__BY__DECL_DEF_VISIT, __VA_ARGS__)
to Top