-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathScope.hpp
More file actions
41 lines (28 loc) · 772 Bytes
/
Scope.hpp
File metadata and controls
41 lines (28 loc) · 772 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
36
37
38
39
40
41
#ifndef ALPHA_SCOPE_HPP
#define ALPHA_SCOPE_HPP
#include <ostream>
#include <string>
#include <memory>
#include <map>
#include <vector>
#include "types.hpp"
#include "Decl.hpp"
class VarDecl;
class Scope {
private:
const u32_t _prev_used_storage;
std::map<std::string, std::vector<VarDecl*>> _existing_vars;
std::vector<std::unique_ptr<const Decl>> _decls;
public:
Scope* predecessor;
explicit Scope(Scope*);
virtual ~Scope() { }
u32_t usedStorage() const;
void addVarDecl(const std::string&, VarDecl*);
const VarDecl* getVarDecl(const std::string&) const;
void addDecl(const Decl*);
void prepare();
virtual void eval(std::ostream&) const;
};
const VarDecl* seekingDown(const std::string&, const Scope*);
#endif