2022-08-04 23:35:33 +01:00
|
|
|
// This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details
|
|
|
|
|
|
|
|
#include "Luau/ApplyTypeFunction.h"
|
|
|
|
|
|
|
|
namespace Luau
|
|
|
|
{
|
|
|
|
|
|
|
|
bool ApplyTypeFunction::isDirty(TypeId ty)
|
|
|
|
{
|
|
|
|
if (typeArguments.count(ty))
|
|
|
|
return true;
|
2023-01-04 20:53:17 +00:00
|
|
|
else if (const FreeType* ftv = get<FreeType>(ty))
|
2022-08-04 23:35:33 +01:00
|
|
|
{
|
|
|
|
if (ftv->forwardedTypeAlias)
|
|
|
|
encounteredForwardedType = true;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool ApplyTypeFunction::isDirty(TypePackId tp)
|
|
|
|
{
|
|
|
|
if (typePackArguments.count(tp))
|
|
|
|
return true;
|
|
|
|
else
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool ApplyTypeFunction::ignoreChildren(TypeId ty)
|
|
|
|
{
|
2023-01-04 20:53:17 +00:00
|
|
|
if (get<GenericType>(ty))
|
2022-08-04 23:35:33 +01:00
|
|
|
return true;
|
2023-06-24 07:19:39 +01:00
|
|
|
else if (get<ClassType>(ty))
|
2022-08-11 22:01:33 +01:00
|
|
|
return true;
|
2022-08-04 23:35:33 +01:00
|
|
|
else
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool ApplyTypeFunction::ignoreChildren(TypePackId tp)
|
|
|
|
{
|
|
|
|
if (get<GenericTypePack>(tp))
|
|
|
|
return true;
|
|
|
|
else
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
TypeId ApplyTypeFunction::clean(TypeId ty)
|
|
|
|
{
|
|
|
|
TypeId& arg = typeArguments[ty];
|
|
|
|
LUAU_ASSERT(arg);
|
|
|
|
return arg;
|
|
|
|
}
|
|
|
|
|
|
|
|
TypePackId ApplyTypeFunction::clean(TypePackId tp)
|
|
|
|
{
|
|
|
|
TypePackId& arg = typePackArguments[tp];
|
|
|
|
LUAU_ASSERT(arg);
|
|
|
|
return arg;
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace Luau
|