Loading...
Searching...
No Matches
expander.hpp
Go to the documentation of this file.
1
2#pragma once
3
6
7namespace by {
8
57 class _nout expander: public visitor {
59
60
64 struct _nout expansion {
65 nbool isExpanded() const;
66
67 public:
68 tweak<obj> me;
69 tweak<func> fun;
70 };
71
72 public:
73 expander();
74
75 public:
76 void rel() override;
77
78 using super::onVisit;
79
80 nbool onVisit(const visitInfo& i, defAssignExpr& me, nbool) override;
81 nbool onVisit(const visitInfo& i, asExpr& me, nbool) override;
82 nbool onVisit(const visitInfo& i, obj& me, nbool) override;
83 void onLeave(const visitInfo& i, obj& me, nbool) override;
84 nbool onVisit(const visitInfo& i, func& me, nbool) override;
85 void onLeave(const visitInfo& i, func& me, nbool) override;
86 nbool onVisit(const visitInfo& i, baseFunc& me, nbool) override;
87 void onLeave(const visitInfo& i, baseFunc& me, nbool) override;
88 nbool onVisit(const visitInfo& i, getGenericExpr& me, nbool) override;
89
90 protected:
91 void _onWork() override;
92
93 private:
94 nbool _onVisitParams(baseFunc& f, param& p);
95 void _onVisitFuncRet(baseFunc& f);
96
97 void _convergeTypes(errReport& rpt);
98
99 void _rel();
100
104 nbool _expandAll(errReport& rpt);
105
109 nbool _expand(errReport& rpt, expansion& eval);
110 void _delEval(const std::map<obj*, expansion>::iterator& e);
111 void _expand();
112 nbool _isAllExpanded(obj& key) const;
113
114 private:
115 std::map<obj*, expansion> _stack;
117 std::vector<obj*> _obj;
118 std::vector<baseFunc*> _funcs;
119 };
120} // namespace by
Type casting expression.
Definition asExpr.hpp:17
Base class for all function types.
Definition baseFunc.hpp:41
Variable definition with assignment expression.
Definition defAssignExpr.hpp:12
Error report collector.
Definition errReport.hpp:24
Visitor for expanding generic types and expressions.
Definition expander.hpp:57
Function definition in byeol language.
Definition func.hpp:38
Generic type access expression.
Definition getGenericExpr.hpp:19
Byeol runtime environment object.
Definition obj.hpp:62
Function parameter.
Definition param.hpp:14
Definition tnarr.hpp:9
Visitor context information.
Definition visitInfo.hpp:11
Base visitor class for AST traversal.
Definition visitor.hpp:61
to Top