Fix unhandled cases of casting to array & function types
This commit is contained in:
parent
2f5ad00b6d
commit
9826961c76
1 changed files with 12 additions and 0 deletions
|
|
@ -472,6 +472,18 @@ namespace pslang::interpreter
|
||||||
return std::visit([&](auto const & type){ return cast_impl(value, type); }, type);
|
return std::visit([&](auto const & type){ return cast_impl(value, type); }, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
value cast_impl(primitive_value_base<T> const &, type::array_type const &)
|
||||||
|
{
|
||||||
|
throw std::runtime_error("Cannot cast anything to array type");
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
value cast_impl(primitive_value_base<T> const &, type::function_type const &)
|
||||||
|
{
|
||||||
|
throw std::runtime_error("Cannot cast anything to function type");
|
||||||
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
value cast_impl(primitive_value_base<T> const & value, type::type const & type)
|
value cast_impl(primitive_value_base<T> const & value, type::type const & type)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue