Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Roblox
GitHub Repository: Roblox/luau
Path: blob/master/Analysis/src/ApplyTypeFunction.cpp
2764 views
1
// This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details
2
3
#include "Luau/ApplyTypeFunction.h"
4
5
namespace Luau
6
{
7
8
bool ApplyTypeFunction::isDirty(TypeId ty)
9
{
10
if (typeArguments.count(ty))
11
return true;
12
else if (const FreeType* ftv = get<FreeType>(ty))
13
{
14
if (ftv->forwardedTypeAlias)
15
encounteredForwardedType = true;
16
return false;
17
}
18
else
19
return false;
20
}
21
22
bool ApplyTypeFunction::isDirty(TypePackId tp)
23
{
24
if (typePackArguments.count(tp))
25
return true;
26
else
27
return false;
28
}
29
30
bool ApplyTypeFunction::ignoreChildren(TypeId ty)
31
{
32
if (get<GenericType>(ty))
33
return true;
34
else if (get<ExternType>(ty))
35
return true;
36
else
37
return false;
38
}
39
40
bool ApplyTypeFunction::ignoreChildren(TypePackId tp)
41
{
42
if (get<GenericTypePack>(tp))
43
return true;
44
else
45
return false;
46
}
47
48
TypeId ApplyTypeFunction::clean(TypeId ty)
49
{
50
TypeId& arg = typeArguments[ty];
51
LUAU_ASSERT(arg);
52
return arg;
53
}
54
55
TypePackId ApplyTypeFunction::clean(TypePackId tp)
56
{
57
TypePackId& arg = typePackArguments[tp];
58
LUAU_ASSERT(arg);
59
return arg;
60
}
61
62
} // namespace Luau
63
64