From bd44c9eaef1f4dcbbd98d4489885566b6c7e5138 Mon Sep 17 00:00:00 2001 From: Nagi5Yeq Date: Sun, 31 May 2020 04:03:00 +0800 Subject: support for type alias --- VariableList.hh | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'VariableList.hh') 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, Value>; // name and type -using Declaration = std::pair>; +using Declaration = std::pair>; 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 FindTypeAlias(const std::string& name); + void AddTypeAlias(const std::string& name, std::shared_ptr type); protected: std::unordered_map variables_; + std::unordered_map> TypeAlias_; VariableList* parent_; }; } // namespace pcc -- cgit