summaryrefslogtreecommitdiff
path: root/VariableList.hh
diff options
context:
space:
mode:
authorNagi5Yeq <wu@x-nagi.com>2020-05-31 04:03:00 +0800
committerNagi5Yeq <wu@x-nagi.com>2020-05-31 04:03:00 +0800
commitbd44c9eaef1f4dcbbd98d4489885566b6c7e5138 (patch)
treed664ec481b99e04386c47526b56085320edd9cde /VariableList.hh
parentfd21f31e654a97027799f0fdf3518fd639415121 (diff)
support for type alias
Diffstat (limited to 'VariableList.hh')
-rw-r--r--VariableList.hh13
1 files changed, 10 insertions, 3 deletions
diff --git a/VariableList.hh b/VariableList.hh
index cf622ee..ec41b0c 100644
--- a/VariableList.hh
+++ b/VariableList.hh
@@ -8,19 +8,26 @@
#include "Type.hh"
namespace pcc {
+class TypeIdentifier;
+
// type and value
using Variable = std::pair<std::shared_ptr<Type>, Value>;
// name and type
-using Declaration = std::pair<std::string, std::shared_ptr<Type>>;
+using Declaration = std::pair<std::string, std::shared_ptr<TypeIdentifier>>;
class VariableList {
public:
VariableList(VariableList* parent = nullptr);
- Variable Find(const std::string& name);
- void Add(std::string name, Variable variable);
+ Variable FindVariable(const std::string& name);
+ void AddVariable(const std::string& name, Variable variable);
+
+ // stores type alias, just because we wan't create another TypeAliasList
+ std::shared_ptr<Type> FindTypeAlias(const std::string& name);
+ void AddTypeAlias(const std::string& name, std::shared_ptr<Type> type);
protected:
std::unordered_map<std::string, Variable> variables_;
+ std::unordered_map<std::string, std::shared_ptr<Type>> TypeAlias_;
VariableList* parent_;
};
} // namespace pcc