pslang/libs/ast/source/expression.cpp

38 lines
798 B
C++

#include <pslang/ast/expression.hpp>
namespace pslang::ast
{
namespace
{
template <typename T>
location get_location_impl(numeric_literal_base<T> const & expression)
{
return expression.location;
}
location get_location_impl(literal const & expression)
{
return std::visit([](auto const & expression){ return get_location_impl(expression); }, expression);
}
template <typename Expression>
location get_location_impl(Expression const & expression)
{
return expression.location;
}
location get_location_impl(expression const & expression)
{
return std::visit([](auto const & expression){ return get_location_impl(expression); }, expression);
}
}
location get_location(expression const & expression)
{
return get_location_impl(expression);
}
}