Move the macros to be at the top.

This commit is contained in:
Alexander McCord 2024-06-02 19:41:34 -07:00
parent 56d4f52434
commit b25df642da

View file

@ -9,32 +9,6 @@
#include <type_traits>
#include <utility>
namespace Luau::EqSat
{
template<typename T, typename = void>
struct LanguageHash
{
size_t operator()(const T&) const
{
// See available specializations at the bottom of this file.
static_assert(false, "missing languageHash specialization");
}
};
template <typename T>
std::size_t languageHash(const T& lang)
{
return LanguageHash<T>{}(lang);
}
// We have four different kinds of declarations:
//
// Atom, the root data type that holds the value in question.
// NodeArray, a fixed sized sequence of `Id`s.
// NodeVector, a dynamically sized sequence of `Id`s.
// NodeFields, a fixed sized sequence of `Id`s accessed by field names rather than subscripts.
#define LUAU_EQSAT_ATOM(name, t) \
struct name : public ::Luau::EqSat::Atom<name, t> \
{ \
@ -68,6 +42,25 @@ std::size_t languageHash(const T& lang)
using NodeFields::NodeFields; \
}
namespace Luau::EqSat
{
template<typename T, typename = void>
struct LanguageHash
{
size_t operator()(const T&) const
{
// See available specializations at the bottom of this file.
static_assert(false, "missing languageHash specialization");
}
};
template <typename T>
std::size_t languageHash(const T& lang)
{
return LanguageHash<T>{}(lang);
}
template<typename Phantom, typename T>
struct Atom
{