Browse Source

AST: Rename function addElement -> add

master
Riyyi 2 years ago
parent
commit
03918b036d
  1. 2
      src/ast.cpp
  2. 2
      src/ast.h
  3. 2
      src/eval.cpp
  4. 2
      src/reader.cpp

2
src/ast.cpp

@ -23,7 +23,7 @@ void Collection::add(ASTNodePtr node)
// ----------------------------------------- // -----------------------------------------
void HashMap::addElement(const std::string& key, ASTNodePtr value) void HashMap::add(const std::string& key, ASTNodePtr value)
{ {
m_elements.emplace(key, value); m_elements.emplace(key, value);
} }

2
src/ast.h

@ -101,7 +101,7 @@ public:
virtual bool isHashMap() const override { return true; } virtual bool isHashMap() const override { return true; }
void addElement(const std::string& key, ASTNodePtr value); void add(const std::string& key, ASTNodePtr value);
const std::unordered_map<std::string, ASTNodePtr>& elements() const { return m_elements; } const std::unordered_map<std::string, ASTNodePtr>& elements() const { return m_elements; }
size_t size() const { return m_elements.size(); } size_t size() const { return m_elements.size(); }

2
src/eval.cpp

@ -157,7 +157,7 @@ ASTNodePtr Eval::evalAst(ASTNodePtr ast, EnvironmentPtr env)
if (element_node == nullptr) { if (element_node == nullptr) {
return nullptr; return nullptr;
} }
result->addElement(element.first, element_node); result->add(element.first, element_node);
} }
return result; return result;
} }

2
src/reader.cpp

@ -197,7 +197,7 @@ ASTNodePtr Reader::readHashMap()
} }
std::string keyString = is<String>(key.get()) ? std::static_pointer_cast<String>(key)->data() : std::static_pointer_cast<Keyword>(key)->keyword(); std::string keyString = is<String>(key.get()) ? std::static_pointer_cast<String>(key)->data() : std::static_pointer_cast<Keyword>(key)->keyword();
hash_map->addElement(keyString, value); hash_map->add(keyString, value);
} }
if (!consumeSpecific(Token { .type = Token::Type::BraceClose })) { // } if (!consumeSpecific(Token { .type = Token::Type::BraceClose })) { // }

Loading…
Cancel
Save