closure.hpp
Go to the documentation of this file.
1
2#pragma once
3
7
8namespace by {
9
10 class getExpr;
11 class func;
12 class defNestedFuncExpr;
13
19 class _nout closure: public baseFunc {
20 BY(ME(closure, baseFunc), CLONE(closure), VISIT())
21
22 public:
23 closure(const baseObj& org, const baseFunc& func);
24
25 public:
26 const ntype& getType() const override;
27
28 using super::subs;
29 scope& subs() override;
30
31 using super::prioritize;
32 priorType prioritize(const args& a) const override;
33
34 const modifier& getModifier() const override;
35
36 using super::run;
37 str run(const args& a) override;
38
39 const baseObj& getOrigin() const override;
40
41 const baseFunc& getFunc() const;
42
43 using super::getParams;
44 params& getParams() override;
45
46 const node* getRet() const override;
47
48 const src& getSrc() const override;
49
50 static me* make(const node& e);
51 static me* make(const node* it) BY_SIDE_FUNC(make);
52
53 private:
54 static me* _make(const func& e);
55 static me* _make(const func* it) BY_SIDE_FUNC(_make) static me* _make(const getExpr& e);
56 static me* _make(const getExpr* it) BY_SIDE_FUNC(_make);
57 static me* _make(defNestedFuncExpr& e);
58 static me* _make(defNestedFuncExpr* it) BY_SIDE_FUNC(_make);
59
60 private:
61 tstr<baseObj> _org;
62 tstr<baseFunc> _func;
63 funcMgdType _type;
64 };
65} // namespace by
Function call arguments container.
Definition: args.hpp:13
Base class for all function types.
Definition: baseFunc.hpp:18
Base class for all objects in byeol language.
Definition: baseObj.hpp:24
func closure with captured object scope
Definition: closure.hpp:19
params & getParams() override
const node * getRet() const override
Nested func definition expression (lambda)
Definition: defNestedFuncExpr.hpp:13
Function definition in byeol language.
Definition: func.hpp:20
Managed type for function objects.
Definition: funcMgdType.hpp:10
Expression for property and method access.
Definition: getExpr.hpp:17
Access modifier for class members and func.
Definition: modifier.hpp:12
Base class for all AST nodes in byeol language.
Definition: node.hpp:30
Native type system for byeol language.
Definition: ntype.hpp:19
Function parameter list container.
Definition: params.hpp:15
Source location information.
Definition: src.hpp:11
priorType
the lower value, the higher priority.
Definition: tpriorities.hpp:8