aboutsummaryrefslogtreecommitdiff
path: root/src/core/symbol_table.cc
diff options
context:
space:
mode:
authorRichard Qin <richard.qin.x@gmail.com>2026-04-07 03:59:58 +0800
committerRichard Qin <richard.qin.x@gmail.com>2026-04-07 03:59:58 +0800
commit5ab3efd522cf0221481684b5bbc9c2ac6bfc9919 (patch)
tree9c521dedd2bc49bdbac642a0640dd048b6d8e4a1 /src/core/symbol_table.cc
parentbf4f464cec8b6515d9e5131d43847ef9b2fd21d1 (diff)
downloadratp-5ab3efd522cf0221481684b5bbc9c2ac6bfc9919.tar.gz
ratp-5ab3efd522cf0221481684b5bbc9c2ac6bfc9919.tar.xz
refactor: rename struct members to follow trailing underscore naming convention across core, search, and frontend components
Diffstat (limited to 'src/core/symbol_table.cc')
-rw-r--r--src/core/symbol_table.cc17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/core/symbol_table.cc b/src/core/symbol_table.cc
index 42c7dd8..b707132 100644
--- a/src/core/symbol_table.cc
+++ b/src/core/symbol_table.cc
@@ -21,7 +21,9 @@
#include "atp/core/types.h"
#include <cstddef>
+#include <cstdint>
#include <stdexcept>
+#include <string>
#include <string_view>
namespace atp {
@@ -29,22 +31,23 @@ namespace atp {
SymbolId SymbolTable::intern(std::string_view name, SymbolKind kind, uint16_t arity, SortId sort) {
auto it = name_to_id_.find(name);
if (it != name_to_id_.end()) {
- SymbolId id = it->second;
- SymbolInfo& info = infos_[id];
- if (info.kind != kind || info.arity != arity) {
+ SymbolId const id = it->second;
+ SymbolInfo const& info = infos_[id];
+ if (info.kind_ != kind || info.arity_ != arity) {
throw std::runtime_error("Symbol kind or arity mismatch for: " + std::string(name));
}
return id;
}
auto new_id = static_cast<SymbolId>(infos_.size());
- infos_.push_back({.name = std::string(name), .kind = kind, .arity = arity, .sort = sort});
- std::string_view stable_name_view = infos_.back().name;
+ infos_.push_back(SymbolInfo{
+ .name_ = std::string(name), .kind_ = kind, .arity_ = arity, .sort_ = sort});
+ std::string_view const stable_name_view = infos_.back().name_;
name_to_id_.emplace(stable_name_view, new_id);
return new_id;
}
std::string_view SymbolTable::getName(SymbolId id) const {
- return infos_[id].name;
+ return infos_[id].name_;
}
const SymbolInfo& SymbolTable::getInfo(SymbolId id) const {
@@ -52,7 +55,7 @@ const SymbolInfo& SymbolTable::getInfo(SymbolId id) const {
}
bool SymbolTable::isVariable(SymbolId id) const {
- return infos_[id].kind == SymbolKind::kVariable;
+ return infos_[id].kind_ == SymbolKind::kVariable;
}
size_t SymbolTable::size() const {