2022-04-08 04:53:47 +08:00
|
|
|
// This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details
|
|
|
|
#pragma once
|
|
|
|
|
2022-10-22 01:33:43 +08:00
|
|
|
#include <Luau/NotNull.h>
|
2022-05-20 07:46:52 +08:00
|
|
|
#include "Luau/TypeArena.h"
|
2023-01-04 01:33:19 +08:00
|
|
|
#include "Luau/Type.h"
|
2022-04-08 04:53:47 +08:00
|
|
|
|
|
|
|
#include <unordered_map>
|
|
|
|
|
|
|
|
namespace Luau
|
|
|
|
{
|
|
|
|
|
|
|
|
// Only exposed so they can be unit tested.
|
|
|
|
using SeenTypes = std::unordered_map<TypeId, TypeId>;
|
|
|
|
using SeenTypePacks = std::unordered_map<TypePackId, TypePackId>;
|
|
|
|
|
|
|
|
struct CloneState
|
|
|
|
{
|
2022-04-15 05:57:15 +08:00
|
|
|
SeenTypes seenTypes;
|
|
|
|
SeenTypePacks seenTypePacks;
|
|
|
|
|
2022-04-08 04:53:47 +08:00
|
|
|
int recursionCount = 0;
|
|
|
|
};
|
|
|
|
|
2022-04-15 05:57:15 +08:00
|
|
|
TypePackId clone(TypePackId tp, TypeArena& dest, CloneState& cloneState);
|
|
|
|
TypeId clone(TypeId tp, TypeArena& dest, CloneState& cloneState);
|
|
|
|
TypeFun clone(const TypeFun& typeFun, TypeArena& dest, CloneState& cloneState);
|
2022-04-08 04:53:47 +08:00
|
|
|
|
2022-08-12 04:42:54 +08:00
|
|
|
TypeId shallowClone(TypeId ty, TypeArena& dest, const TxnLog* log, bool alwaysClone = false);
|
2022-10-22 01:33:43 +08:00
|
|
|
TypeId shallowClone(TypeId ty, NotNull<TypeArena> dest);
|
2022-06-04 04:32:20 +08:00
|
|
|
|
2022-04-08 04:53:47 +08:00
|
|
|
} // namespace Luau
|