blob: 8eeb3c18368c160df86631c6e1b5e4ad7b5606c3 (
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
31
|
#ifndef AST_DECLARATION_HPP
#define AST_DECLARATION_HPP
#include "ast.hpp"
// Declaration that holds a list of declarations
class Declaration : public Node {
protected:
Type* type;
std::string id;
Initializer* init;
Declaration* decl;
public:
Declaration(const std::string& _id = "") : id(_id) {}
virtual void print() const {
if(decl != nullptr)
decl->print();
std::cout << id << std::endl;
}
virtual void printxml() const {}
virtual void printasm() const {}
void addDeclaration(Declaration* _decl) {
decl = _decl;
}
};
#endif
|