forked from justas05/Compiler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunction.hpp
37 lines (26 loc) · 783 Bytes
/
function.hpp
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
31
32
33
34
35
36
37
#ifndef AST_FUNCTION_HPP
#define AST_FUNCTION_HPP
#include "bindings.hpp"
#include "declaration.hpp"
#include "node.hpp"
#include "statement.hpp"
#include "type.hpp"
#include <memory>
#include <string>
class Function;
typedef std::shared_ptr<Function> FunctionPtr;
class Function : public Node {
protected:
TypePtr type_;
std::string id_;
StatementPtr statement_;
DeclarationPtr parameter_list_;
public:
Function(const std::string& id, Statement* statement, DeclarationPtr parameter_list = nullptr);
virtual void print() const;
virtual void printXml() const;
virtual Bindings printAsm(Bindings bindings, int& label_count) const;
void printParameterAsm(Bindings& bindings, int& frame_offset) const;
void countParameters(int& parameter_count) const;
};
#endif