2022-08-18 22:32:08 +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"
|
|
|
|
#include "Luau/Substitution.h"
|
|
|
|
#include "Luau/TypeVar.h"
|
|
|
|
|
|
|
|
#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
|
|
|
|
{
|
2022-09-08 23:14:25 +01:00
|
|
|
Anyification(TypeArena* arena, NotNull<Scope> scope, NotNull<SingletonTypes> singletonTypes, InternalErrorReporter* iceHandler, TypeId anyType,
|
|
|
|
TypePackId anyTypePack);
|
|
|
|
Anyification(TypeArena* arena, const ScopePtr& scope, NotNull<SingletonTypes> singletonTypes, InternalErrorReporter* iceHandler, TypeId anyType,
|
|
|
|
TypePackId anyTypePack);
|
2022-08-18 22:32:08 +01:00
|
|
|
NotNull<Scope> scope;
|
2022-09-08 23:14:25 +01:00
|
|
|
NotNull<SingletonTypes> singletonTypes;
|
2022-08-18 22:32:08 +01: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;
|
|
|
|
};
|
|
|
|
|
2022-09-02 00:14:03 +01:00
|
|
|
} // namespace Luau
|