mirror of
https://github.com/luau-lang/luau.git
synced 2025-05-04 10:33:46 +01:00
Use result var for typepacks
This one is easier to switch
This commit is contained in:
parent
7f9e945007
commit
a7fd656826
1 changed files with 13 additions and 7 deletions
|
@ -5200,9 +5200,10 @@ TypePackId TypeChecker::resolveTypePack(const ScopePtr& scope, const AstTypeList
|
||||||
|
|
||||||
TypePackId TypeChecker::resolveTypePack(const ScopePtr& scope, const AstTypePack& annotation)
|
TypePackId TypeChecker::resolveTypePack(const ScopePtr& scope, const AstTypePack& annotation)
|
||||||
{
|
{
|
||||||
|
TypePackId result;
|
||||||
if (const AstTypePackVariadic* variadic = annotation.as<AstTypePackVariadic>())
|
if (const AstTypePackVariadic* variadic = annotation.as<AstTypePackVariadic>())
|
||||||
{
|
{
|
||||||
return currentModule->astResolvedTypePacks[&annotation] = addTypePack(TypePackVar{VariadicTypePack{resolveType(scope, *variadic->variadicType)}});
|
result = addTypePack(TypePackVar{VariadicTypePack{resolveType(scope, *variadic->variadicType)}});
|
||||||
}
|
}
|
||||||
else if (const AstTypePackGeneric* generic = annotation.as<AstTypePackGeneric>())
|
else if (const AstTypePackGeneric* generic = annotation.as<AstTypePackGeneric>())
|
||||||
{
|
{
|
||||||
|
@ -5216,10 +5217,12 @@ TypePackId TypeChecker::resolveTypePack(const ScopePtr& scope, const AstTypePack
|
||||||
else
|
else
|
||||||
reportError(TypeError{generic->location, UnknownSymbol{genericName, UnknownSymbol::Type}});
|
reportError(TypeError{generic->location, UnknownSymbol{genericName, UnknownSymbol::Type}});
|
||||||
|
|
||||||
return currentModule->astResolvedTypePacks[&annotation] = errorRecoveryTypePack(scope);
|
result = errorRecoveryTypePack(scope);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = *genericTy;
|
||||||
}
|
}
|
||||||
|
|
||||||
return currentModule->astResolvedTypePacks[&annotation] = *genericTy;
|
|
||||||
}
|
}
|
||||||
else if (const AstTypePackExplicit* explicitTp = annotation.as<AstTypePackExplicit>())
|
else if (const AstTypePackExplicit* explicitTp = annotation.as<AstTypePackExplicit>())
|
||||||
{
|
{
|
||||||
|
@ -5229,14 +5232,17 @@ TypePackId TypeChecker::resolveTypePack(const ScopePtr& scope, const AstTypePack
|
||||||
types.push_back(resolveType(scope, *type));
|
types.push_back(resolveType(scope, *type));
|
||||||
|
|
||||||
if (auto tailType = explicitTp->typeList.tailType)
|
if (auto tailType = explicitTp->typeList.tailType)
|
||||||
return currentModule->astResolvedTypePacks[&annotation] = addTypePack(types, resolveTypePack(scope, *tailType));
|
result = addTypePack(types, resolveTypePack(scope, *tailType));
|
||||||
|
else
|
||||||
return currentModule->astResolvedTypePacks[&annotation] = addTypePack(types);
|
result = addTypePack(types);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ice("Unknown AstTypePack kind");
|
ice("Unknown AstTypePack kind");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
currentModule->astResolvedTypePacks[&annotation] = result;
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ApplyTypeFunction::isDirty(TypeId ty)
|
bool ApplyTypeFunction::isDirty(TypeId ty)
|
||||||
|
|
Loading…
Add table
Reference in a new issue