Skip to content

Commit

Permalink
Fix constructor bug and add inline function for core determination
Browse files Browse the repository at this point in the history
  • Loading branch information
riccardodebenedictis committed Mar 27, 2024
1 parent 33201e4 commit 3a6f34d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion extern/utils
Submodule utils updated 2 files
+5 −5 CMakeLists.txt
+25 −25 include/logging.hpp
2 changes: 2 additions & 0 deletions include/core.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,8 @@ namespace riddle

[[nodiscard]] type &determine_type(const std::vector<std::shared_ptr<item>> &xprs);

inline bool is_core(const scope &scp) noexcept { return &scp == &scp.get_core(); }

class unsolvable_exception : public std::exception
{
const char *what() const noexcept override { return "the problem is unsolvable.."; }
Expand Down
3 changes: 2 additions & 1 deletion src/constructor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ namespace riddle
{
case 0:
if (auto c_tp = dynamic_cast<component_type *>(&f->get_type()))
instance->items.emplace(f_name, f->get_type().new_instance());
instance->items.emplace(f_name, c_tp->new_instance());
else
instance->items.emplace(f_name, f->get_type().new_instance());
break;
Expand All @@ -100,6 +100,7 @@ namespace riddle
throw std::runtime_error("Cannot find constructor for class " + f->get_type().get_name());
}
}
break;
default:
{
std::vector<std::reference_wrapper<const type>> arg_types;
Expand Down

0 comments on commit 3a6f34d

Please sign in to comment.