luau/Analysis/include/Luau/Clone.h

32 lines
811 B
C
Raw Normal View History

2022-04-07 22:29:01 +01:00
// 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>
2022-05-20 01:02:24 +01:00
#include "Luau/TypeArena.h"
#include "Luau/Type.h"
2022-04-07 22:29:01 +01: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
{
NotNull<BuiltinTypes> builtinTypes;
2022-04-15 00:57:43 +01:00
SeenTypes seenTypes;
SeenTypePacks seenTypePacks;
2022-04-07 22:29:01 +01:00
int recursionCount = 0;
};
2022-04-15 00:57:43 +01: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-07 22:29:01 +01:00
} // namespace Luau