mirror of
https://github.com/luau-lang/luau.git
synced 2024-11-15 22:35:43 +08:00
33 lines
922 B
C++
33 lines
922 B
C++
// This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details
|
|
#pragma once
|
|
|
|
#include <Luau/NotNull.h>
|
|
#include "Luau/TypeArena.h"
|
|
#include "Luau/Type.h"
|
|
|
|
#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
|
|
{
|
|
SeenTypes seenTypes;
|
|
SeenTypePacks seenTypePacks;
|
|
|
|
int recursionCount = 0;
|
|
};
|
|
|
|
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);
|
|
|
|
TypeId shallowClone(TypeId ty, TypeArena& dest, const TxnLog* log, bool alwaysClone = false);
|
|
TypeId shallowClone(TypeId ty, NotNull<TypeArena> dest);
|
|
|
|
} // namespace Luau
|