style(sema): 规范符号表代码位置
This commit is contained in:
@@ -8,16 +8,9 @@
|
||||
|
||||
class SymbolTable {
|
||||
public:
|
||||
void Add(const std::string& name, SysYParser::VarDeclContext* decl) {
|
||||
table_[name] = decl;
|
||||
}
|
||||
bool Contains(const std::string& name) const {
|
||||
return table_.find(name) != table_.end();
|
||||
}
|
||||
SysYParser::VarDeclContext* Lookup(const std::string& name) const {
|
||||
auto it = table_.find(name);
|
||||
return it == table_.end() ? nullptr : it->second;
|
||||
}
|
||||
void Add(const std::string& name, SysYParser::VarDeclContext* decl);
|
||||
bool Contains(const std::string& name) const;
|
||||
SysYParser::VarDeclContext* Lookup(const std::string& name) const;
|
||||
|
||||
private:
|
||||
std::unordered_map<std::string, SysYParser::VarDeclContext*> table_;
|
||||
|
||||
Reference in New Issue
Block a user