// This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details #pragma once #include "Luau/TypedAllocator.h" #include "Luau/TypeVar.h" #include "Luau/TypePack.h" #include namespace Luau { struct TypeArena { TypedAllocator typeVars; TypedAllocator typePacks; void clear(); template TypeId addType(T tv) { if constexpr (std::is_same_v) LUAU_ASSERT(tv.options.size() >= 2); return addTV(TypeVar(std::move(tv))); } TypeId addTV(TypeVar&& tv); TypeId freshType(TypeLevel level); TypePackId addTypePack(std::initializer_list types); TypePackId addTypePack(std::vector types); TypePackId addTypePack(TypePack pack); TypePackId addTypePack(TypePackVar pack); template TypePackId addTypePack(T tp) { return addTypePack(TypePackVar(std::move(tp))); } }; void freeze(TypeArena& arena); void unfreeze(TypeArena& arena); } // namespace Luau