summaryrefslogtreecommitdiff
path: root/node/FunctionNode.hh
blob: 415c2cc1acd518805fdeed6236613cf71b9cf65c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#ifndef PCC_FUNCTIONNODE_H
#define PCC_FUNCTIONNODE_H

#include <list>

#include "BaseNode.hh"
#include "StatementNode.hh"
#include "VariableList.hh"

namespace pcc {
class FunctionNode : public BaseNode {
  public:
    FunctionNode(Context* context, std::string&& name,
                 std::list<Declaration>&& arguments,
                 std::list<std::shared_ptr<DeclNode>>&& LocalDeclarations,
                 std::shared_ptr<Type> type,
                 std::shared_ptr<StatementListNode> body);
    virtual Value CodeGen() override;

  protected:
    std::string name_;
    std::list<Declaration> arguments_;
    std::list<std::shared_ptr<DeclNode>> LocalDeclarations_;
    std::shared_ptr<Type> type_;
    VariableList locals_;
    std::shared_ptr<StatementListNode> body_;
};
} // namespace pcc

#endif