LCOV - code coverage report
Current view: top level - src/tables/typeTable - methodTable.cc (source / functions) Coverage Total Hit
Test: coverage.info Lines: 0.0 % 38 0
Test Date: 2025-04-18 15:53:49 Functions: 0.0 % 6 0

            Line data    Source code
       1              : #include "../../../inc/tables/typeTable/types/userTypes/methodTable.h"
       2              : 
       3              : namespace nicole {
       4              : 
       5              : std::vector<Method>
       6            0 : MethodTable::getMethods(const std::string &id) const noexcept {
       7            0 :   if (table_.count(id)) {
       8            0 :     return table_.at(id);
       9            0 :   }
      10            0 :   return {};
      11            0 : }
      12              : 
      13            0 : void MethodTable::insert(const Method &method) noexcept {
      14            0 :   table_[method.id()].push_back(method);
      15            0 : }
      16              : 
      17            0 : void MethodTable::print() const noexcept {
      18            0 :   std::cout << "Methods:\n";
      19            0 :   for (const auto &methods : table_) {
      20            0 :     for (const auto &method : methods.second) {
      21            0 :       std::cout << method.id() << "\n";
      22            0 :     }
      23            0 :   }
      24            0 : }
      25              : 
      26              : std::expected<std::monostate, Error>
      27              : MethodTable::setMethodReturnType(const std::string &id,
      28            0 :                                  const std::shared_ptr<Type> &type) noexcept {
      29            0 :   if (table_.find(id) == table_.end() || table_.at(id).empty()) {
      30            0 :     return createError(ERROR_TYPE::METHOD, "Method not found: " + id);
      31            0 :   }
      32              :   // Se actualiza la última entrada del método con el nuevo tipo de retorno.
      33            0 :   table_[id].back().setReturnType(type);
      34            0 :   return std::expected<std::monostate, Error>{std::monostate{}};
      35            0 : }
      36              : 
      37              : std::expected<std::monostate, Error>
      38              : MethodTable::setMethodParameters(const std::string &id,
      39            0 :                                  const Parameters &params) noexcept {
      40            0 :   if (table_.find(id) == table_.end() || table_.at(id).empty()) {
      41            0 :     return createError(ERROR_TYPE::METHOD, "Method not found: " + id);
      42            0 :   }
      43              :   // Se actualizan los parámetros del método.
      44            0 :   table_[id].back().setParameters(params);
      45            0 :   return std::expected<std::monostate, Error>{std::monostate{}};
      46            0 : }
      47              : 
      48              : std::expected<std::monostate, Error>
      49              : MethodTable::setMethodGenercis(const std::string &id,
      50            0 :                                const std::vector<GenericParameter> &params) noexcept {
      51            0 :   if (table_.find(id) == table_.end() || table_.at(id).empty()) {
      52            0 :     return createError(ERROR_TYPE::METHOD, "Method not found: " + id);
      53            0 :   }
      54              :   // Se actualiza la lista de genéricos del método.
      55            0 :   table_[id].back().setGenerics(params);
      56            0 :   return std::expected<std::monostate, Error>{std::monostate{}};
      57            0 : }
      58              : 
      59              : 
      60              : } // namespace nicole
        

Generated by: LCOV version 2.0-1