1
2
3
4
5
6 #ifndef SNGCM_AST_DELEGATE_INCLUDED
7 #define SNGCM_AST_DELEGATE_INCLUDED
8 #include <sngcm/ast/Parameter.hpp>
9 #include <sngcm/ast/NodeList.hpp>
10 #include <sngcm/ast/Specifier.hpp>
11
12 namespace sngcm { namespace ast {
13
14 class DelegateNode : public Node
15 {
16 public:
17 DelegateNode(const Span& span_);
18 DelegateNode(const Span& span_, Specifiers specifiers_, Node* returnTypeExpr_, IdentifierNode* id_);
19 Node* Clone(CloneContext& cloneContext) const override;
20 void Accept(Visitor& visitor) override;
21 void Write(AstWriter& writer) override;
22 void Read(AstReader& reader) override;
23 void AddParameter(ParameterNode* parameter) override;
24 Specifiers GetSpecifiers() const override { return specifiers; }
25 Node* ReturnTypeExpr() const { return returnTypeExpr.get(); }
26 IdentifierNode* Id() const { return id.get(); }
27 const NodeList<ParameterNode>& Parameters() const { return parameters; }
28 private:
29 Specifiers specifiers;
30 std::unique_ptr<Node> returnTypeExpr;
31 std::unique_ptr<IdentifierNode> id;
32 NodeList<ParameterNode> parameters;
33 };
34
35 class ClassDelegateNode : public Node
36 {
37 public:
38 ClassDelegateNode(const Span& span_);
39 ClassDelegateNode(const Span& span_, Specifiers specifiers_, Node* returnTypeExpr_, IdentifierNode* id_);
40 Node* Clone(CloneContext& cloneContext) const override;
41 void Accept(Visitor& visitor) override;
42 void Write(AstWriter& writer) override;
43 void Read(AstReader& reader) override;
44 void AddParameter(ParameterNode* parameter) override;
45 Specifiers GetSpecifiers() const override { return specifiers; }
46 Node* ReturnTypeExpr() const { return returnTypeExpr.get(); }
47 IdentifierNode* Id() const { return id.get(); }
48 const NodeList<ParameterNode>& Parameters() const { return parameters; }
49 private:
50 Specifiers specifiers;
51 std::unique_ptr<Node> returnTypeExpr;
52 std::unique_ptr<IdentifierNode> id;
53 NodeList<ParameterNode> parameters;
54 };
55
56 } }
57
58 #endif // SNGCM_AST_DELEGATE_INCLUDED