2022-08-19 05:04:33 +08: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"
|
|
|
|
#include "Luau/Substitution.h"
|
2023-10-21 04:36:26 +08:00
|
|
|
#include "Luau/TypeFwd.h"
|
2022-08-19 05:04:33 +08:00
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
namespace Luau
|
|
|
|
{
|
|
|
|
|
|
|
|
struct TypeArena;
|
|
|
|
struct Scope;
|
|
|
|
struct InternalErrorReporter;
|
|
|
|
using ScopePtr = std::shared_ptr<Scope>;
|
|
|
|
|
|
|
|
// A substitution which replaces free types by any
|
|
|
|
struct Anyification : Substitution
|
|
|
|
{
|
2023-01-04 01:33:19 +08:00
|
|
|
Anyification(TypeArena* arena, NotNull<Scope> scope, NotNull<BuiltinTypes> builtinTypes, InternalErrorReporter* iceHandler, TypeId anyType,
|
2022-09-09 05:44:50 +08:00
|
|
|
TypePackId anyTypePack);
|
2023-01-04 01:33:19 +08:00
|
|
|
Anyification(TypeArena* arena, const ScopePtr& scope, NotNull<BuiltinTypes> builtinTypes, InternalErrorReporter* iceHandler, TypeId anyType,
|
2022-09-09 05:44:50 +08:00
|
|
|
TypePackId anyTypePack);
|
2022-08-19 05:04:33 +08:00
|
|
|
NotNull<Scope> scope;
|
2023-01-04 01:33:19 +08:00
|
|
|
NotNull<BuiltinTypes> builtinTypes;
|
2022-08-19 05:04:33 +08:00
|
|
|
InternalErrorReporter* iceHandler;
|
|
|
|
|
|
|
|
TypeId anyType;
|
|
|
|
TypePackId anyTypePack;
|
|
|
|
bool normalizationTooComplex = false;
|
|
|
|
bool isDirty(TypeId ty) override;
|
|
|
|
bool isDirty(TypePackId tp) override;
|
|
|
|
TypeId clean(TypeId ty) override;
|
|
|
|
TypePackId clean(TypePackId tp) override;
|
|
|
|
|
|
|
|
bool ignoreChildren(TypeId ty) override;
|
|
|
|
bool ignoreChildren(TypePackId ty) override;
|
|
|
|
};
|
|
|
|
|
2023-10-21 04:36:26 +08:00
|
|
|
} // namespace Luau
|