// 维护对象符号的多层作用域。 #pragma once #include #include #include #include #include "sem/Sema.h" class SymbolTable { public: SymbolTable(); void EnterScope(); void ExitScope(); bool Add(const ObjectBinding& symbol); bool ContainsInCurrentScope(std::string_view name) const; const ObjectBinding* Lookup(std::string_view name) const; size_t Depth() const; private: std::vector> scopes_; };