-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVarPool.h
More file actions
35 lines (31 loc) · 759 Bytes
/
VarPool.h
File metadata and controls
35 lines (31 loc) · 759 Bytes
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
#if !defined(__VARPOOL_H__)
#define __VARPOOL_H__
#include <map>
#include "AST.h"
#include "Types.h"
using namespace std;
class VarPool {
public:
VarPool()
: parent(NULL), _size(0),
decls(new map<string, ASTVarDecl *>()),
positioning(new map<string, int>()) {};
VarPool(VarPool *prnt)
: parent(prnt), _size(0),
decls(new map<string, ASTVarDecl *>()),
positioning(new map<string, int>()) {};
~VarPool() {
delete decls;
delete positioning;
};
void add(ASTVarDecl *var);
int index(string varname);
int size();
void reserveIndex();
private:
VarPool *parent;
int _size;
map<string, ASTVarDecl *> *decls;
map<string, int> *positioning;
};
#endif