Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Roblox
GitHub Repository: Roblox/luau
Path: blob/master/Analysis/include/Luau/Anyification.h
2727 views
1
// This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details
2
3
#pragma once
4
5
#include "Luau/NotNull.h"
6
#include "Luau/Substitution.h"
7
#include "Luau/TypeFwd.h"
8
9
#include <memory>
10
11
namespace Luau
12
{
13
14
struct TypeArena;
15
struct Scope;
16
struct InternalErrorReporter;
17
using ScopePtr = std::shared_ptr<Scope>;
18
19
// A substitution which replaces free types by any
20
struct Anyification : Substitution
21
{
22
Anyification(
23
TypeArena* arena,
24
NotNull<Scope> scope,
25
NotNull<BuiltinTypes> builtinTypes,
26
InternalErrorReporter* iceHandler,
27
TypeId anyType,
28
TypePackId anyTypePack
29
);
30
Anyification(
31
TypeArena* arena,
32
const ScopePtr& scope,
33
NotNull<BuiltinTypes> builtinTypes,
34
InternalErrorReporter* iceHandler,
35
TypeId anyType,
36
TypePackId anyTypePack
37
);
38
NotNull<Scope> scope;
39
NotNull<BuiltinTypes> builtinTypes;
40
InternalErrorReporter* iceHandler;
41
42
TypeId anyType;
43
TypePackId anyTypePack;
44
bool normalizationTooComplex = false;
45
bool isDirty(TypeId ty) override;
46
bool isDirty(TypePackId tp) override;
47
TypeId clean(TypeId ty) override;
48
TypePackId clean(TypePackId tp) override;
49
50
bool ignoreChildren(TypeId ty) override;
51
bool ignoreChildren(TypePackId ty) override;
52
};
53
54
} // namespace Luau
55
56