expander.hpp
Go to the documentation of this file.
1
2#pragma once
3
6
7namespace by {
8
13 class _nout expander: public visitor {
14 BY(CLASS(expander, visitor))
15
16
19 struct _nout expansion {
20 nbool isExpanded() const;
21
22 public:
23 tweak<obj> me;
24 tweak<func> fun;
25 };
26
27 public:
28 expander();
29
30 public:
31 void rel() override;
32
33 using super::onVisit;
34
35 nbool onVisit(const visitInfo& i, defAssignExpr& me, nbool) override;
36 nbool onVisit(const visitInfo& i, asExpr& me, nbool) override;
37 nbool onVisit(const visitInfo& i, obj& me, nbool) override;
38 void onLeave(const visitInfo& i, obj& me, nbool) override;
39 nbool onVisit(const visitInfo& i, func& me, nbool) override;
40 void onLeave(const visitInfo& i, func& me, nbool) override;
41 nbool onVisit(const visitInfo& i, baseFunc& me, nbool) override;
42 void onLeave(const visitInfo& i, baseFunc& me, nbool) override;
43 nbool onVisit(const visitInfo& i, getGenericExpr& me, nbool) override;
44
45 protected:
46 void _onWork() override;
47
48 private:
49 nbool _onVisitParams(baseFunc& f, param& p);
50 void _onVisitFuncRet(baseFunc& f);
51
52 void _convergeTypes(errReport& rpt);
53
54 void _rel();
55
57 nbool _expandAll(errReport& rpt);
59 nbool _expand(errReport& rpt, expansion& eval);
60 void _delEval(const std::map<obj*, expansion>::iterator& e);
61 void _expand();
62 nbool _isAllExpanded(obj& key) const;
63
64 private:
65 std::map<obj*, expansion> _stack;
67 std::vector<obj*> _obj;
68 std::vector<baseFunc*> _funcs;
69 };
70} // namespace by
Type casting expression.
Definition: asExpr.hpp:16
Base class for all function types.
Definition: baseFunc.hpp:18
Variable definition with assignment expression.
Definition: defAssignExpr.hpp:11
Error reporting and collection system.
Definition: errReport.hpp:14
Visitor for expanding generic types and expressions.
Definition: expander.hpp:13
Function definition in byeol language.
Definition: func.hpp:20
Generic type access expression.
Definition: getGenericExpr.hpp:15
Managed object in byeol programming environment.
Definition: obj.hpp:19
Function parameter definition.
Definition: param.hpp:13
Definition: tnarr.hpp:9
Weak reference smart pointer with type-safe access.
Definition: tweak.hpp:15
Visitor context information.
Definition: visitInfo.hpp:10
Base visitor class for AST traversal.
Definition: visitor.hpp:20