baseObj.hpp
Go to the documentation of this file.
1
2#pragma once
3
8#include "core/ast/tmock.hpp"
9
10namespace by {
11
12 class baseFunc;
13 typedef tnarr<baseFunc> funcs;
14 class frame;
15 class origin;
16 class obj;
17 class mgdType;
18 template <typename T> class tbaseObjOrigin;
19
24 class _nout baseObj: public node, public statable {
25 BY(ADT(baseObj, node))
26 friend class verifier;
27 friend class obj;
28 friend class defaultMakeCtor;
29 friend class parser; // _setOrigin()
30 friend class genericOrigin; // from genericOrigin::_makeGeneric(), _setOrigin()
31 friend class exprMaker;
32 friend class defVarExpr; // for _setModifier
33 template <typename T> friend class tbaseObjOrigin;
34
35 protected:
38 explicit baseObj() = default;
39 explicit baseObj(const baseObj* org, nbool);
40
41 public:
42 using super::run;
43 str run(const args& a) override;
44
45 using super::subs;
46 scope& subs() override;
47
48 state getState() const override;
49 void setState(state new1) override;
50
51 using super::prioritize;
52 priorType prioritize(const args& a) const override;
53
54 virtual const baseObj& getOrigin() const;
55
56 using super::inFrame;
57 void inFrame(const bicontainable* args) const override;
58 using super::outFrame;
59 void outFrame() const override;
60
61 const src& getSrc() const override;
62
63 virtual const node& getSubPack() const;
64
65 virtual baseObj* make() const;
66
67 const modifier& getModifier() const override;
68
69 protected:
70 str _onRunSub(node& sub, const args& a) override;
71 void _setSrc(const src& s) override;
72 virtual void _inFrame(frame& fr, const bicontainable* args) const;
73
74 // update @ref origin pointer of an object.
75 // to modify origin* is very dangerous. only permitted module should do this.
76 void _setOrigin(const baseObj& newOrg);
77
78 virtual void _setType(const mgdType& new1);
79
80 virtual void _setModifier(const modifier& mod);
81
82 virtual str _onBeforeCtor();
83
84 public:
85 inline static const std::string CTOR_NAME = "@ctor";
86 inline static const std::string COMMON_NAME = "@common";
87 inline static const std::string EXPAND_NAME = "@expand";
88
89 private:
90 tstr<baseObj> _org;
91 };
92
93 typedef tmock<baseObj> mockObj;
94} // namespace by
Function call arguments container.
Definition: args.hpp:13
Base class for all objects in byeol language.
Definition: baseObj.hpp:24
baseObj()=default
Variable definition expression base class.
Definition: defVarExpr.hpp:17
Factory for creating expressions with source location information.
Definition: exprMaker.hpp:17
Execution frame for byeol runtime.
Definition: frame.hpp:29
Generic type origin with type parameters.
Definition: genericOrigin.hpp:15
Managed type for byeol objects.
Definition: mgdType.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
Managed object in byeol programming environment.
Definition: obj.hpp:19
Parser for byeol language source code.
Definition: parser.hpp:43
Source location information.
Definition: src.hpp:11
Interface for objects with compilation state.
Definition: statable.hpp:17
Template base object origin for user-defined classes.
Definition: tbaseObjOrigin.hpp:25
Template bidirectional container interface.
Definition: tbicontainable.hpp:17
Mock object template for testing and verification.
Definition: tmock.hpp:13
AST verifier for semantic analysis.
Definition: verifier.hpp:20
priorType
the lower value, the higher priority.
Definition: tpriorities.hpp:8