mirror of
https://github.com/luau-lang/luau.git
synced 2024-11-15 14:25:44 +08:00
db809395bf
Some checks failed
benchmark / callgrind (map[branch:main name:luau-lang/benchmark-data], ubuntu-22.04) (push) Has been cancelled
build / ${{matrix.os.name}} (map[name:macos version:macos-latest]) (push) Has been cancelled
build / ${{matrix.os.name}} (map[name:macos-arm version:macos-14]) (push) Has been cancelled
build / ${{matrix.os.name}} (map[name:ubuntu version:ubuntu-latest]) (push) Has been cancelled
build / windows (Win32) (push) Has been cancelled
build / windows (x64) (push) Has been cancelled
build / coverage (push) Has been cancelled
build / web (push) Has been cancelled
release / ${{matrix.os.name}} (map[name:macos version:macos-latest]) (push) Has been cancelled
release / ${{matrix.os.name}} (map[name:ubuntu version:ubuntu-20.04]) (push) Has been cancelled
release / ${{matrix.os.name}} (map[name:windows version:windows-latest]) (push) Has been cancelled
release / web (push) Has been cancelled
39 lines
1.1 KiB
C++
39 lines
1.1 KiB
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
|
|
{
|
|
NotNull<BuiltinTypes> builtinTypes;
|
|
|
|
SeenTypes seenTypes;
|
|
SeenTypePacks seenTypePacks;
|
|
};
|
|
|
|
/** `shallowClone` will make a copy of only the _top level_ constructor of the type,
|
|
* while `clone` will make a deep copy of the entire type and its every component.
|
|
*
|
|
* Be mindful about which behavior you actually _want_.
|
|
*/
|
|
|
|
TypePackId shallowClone(TypePackId tp, TypeArena& dest, CloneState& cloneState);
|
|
TypeId shallowClone(TypeId typeId, TypeArena& dest, CloneState& cloneState);
|
|
|
|
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);
|
|
|
|
} // namespace Luau
|