baseFunc.hpp
Go to the documentation of this file.
1
2#pragma once
3
4#include "core/ast/node.hpp"
6
7namespace by {
8
9 class param;
10 template <typename T, typename TACTIC> class tnarr;
11 class params;
12 class visitor;
13
18 class _nout baseFunc: public node {
19 BY(ADT(baseFunc, node), VISIT())
20 friend class generalizer; // for _getType()
21 friend class parser; // for _getType()
22 friend class exprMaker; // for _setSrc()
23
24 public:
25 baseFunc() = default;
26
27 baseFunc(const modifier& mod);
28
29 public:
30 using super::subs;
31 scope& subs() override;
32
33 using super::prioritize;
34 priorType prioritize(const args& a) const override;
35
42 virtual params& getParams();
43 const params& getParams() const BY_CONST_FUNC(getParams());
44
54 virtual const node* getRet() const;
55
56 const src& getSrc() const override;
57
58 const modifier& getModifier() const override;
59
60 virtual const baseObj& getOrigin() const = 0;
61
62 static nbool isFuncButNotClosure(const node& n);
63 static nbool isFuncButNotClosure(const node* it) BY_SIDE_FUNC(isFuncButNotClosure);
64
65 protected:
66 ntype& _getType(); // for generalizer.
67 void _setSrc(const src& newSrc) override;
68
69 private:
70 nbool _isNatureNumber(const node& it) const;
71 priorType _prioritize(const node& param, const node& arg) const;
72
73 private:
74 tstr<modifier> _mod;
75 tstr<src> _src;
76
77 public:
78 static inline const std::string ME = "me";
79 };
80
81 typedef tnarr<baseFunc> funcs;
82} // namespace by
Function call arguments container.
Definition: args.hpp:13
Base class for all function types.
Definition: baseFunc.hpp:18
virtual params & getParams()
Base class for all objects in byeol language.
Definition: baseObj.hpp:24
Factory for creating expressions with source location information.
Definition: exprMaker.hpp:17
Visitor for generic type parameter replacement.
Definition: generalizer.hpp:13
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 definition.
Definition: param.hpp:13
Function parameter list container.
Definition: params.hpp:15
Parser for byeol language source code.
Definition: parser.hpp:43
Source location information.
Definition: src.hpp:11
Definition: tnarr.hpp:9
Strong reference smart pointer with strict type checking.
Definition: tstr.hpp:13
priorType
the lower value, the higher priority.
Definition: tpriorities.hpp:8