-
Notifications
You must be signed in to change notification settings - Fork 358
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
69 changed files
with
3,830 additions
and
1,719 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details | ||
#pragma once | ||
|
||
#include "Luau/Substitution.h" | ||
#include "Luau/TypeVar.h" | ||
#include "Luau/Unifiable.h" | ||
|
||
namespace Luau | ||
{ | ||
|
||
struct TypeArena; | ||
struct TxnLog; | ||
|
||
// A substitution which replaces generic types in a given set by free types. | ||
struct ReplaceGenerics : Substitution | ||
{ | ||
ReplaceGenerics( | ||
const TxnLog* log, TypeArena* arena, TypeLevel level, const std::vector<TypeId>& generics, const std::vector<TypePackId>& genericPacks) | ||
: Substitution(log, arena) | ||
, level(level) | ||
, generics(generics) | ||
, genericPacks(genericPacks) | ||
{ | ||
} | ||
|
||
TypeLevel level; | ||
std::vector<TypeId> generics; | ||
std::vector<TypePackId> genericPacks; | ||
bool ignoreChildren(TypeId ty) override; | ||
bool isDirty(TypeId ty) override; | ||
bool isDirty(TypePackId tp) override; | ||
TypeId clean(TypeId ty) override; | ||
TypePackId clean(TypePackId tp) override; | ||
}; | ||
|
||
// A substitution which replaces generic functions by monomorphic functions | ||
struct Instantiation : Substitution | ||
{ | ||
Instantiation(const TxnLog* log, TypeArena* arena, TypeLevel level) | ||
: Substitution(log, arena) | ||
, level(level) | ||
{ | ||
} | ||
|
||
TypeLevel level; | ||
bool ignoreChildren(TypeId ty) override; | ||
bool isDirty(TypeId ty) override; | ||
bool isDirty(TypePackId tp) override; | ||
TypeId clean(TypeId ty) override; | ||
TypePackId clean(TypePackId tp) override; | ||
}; | ||
|
||
} // namespace Luau |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,4 +39,4 @@ struct TypeArena | |
void freeze(TypeArena& arena); | ||
void unfreeze(TypeArena& arena); | ||
|
||
} | ||
} // namespace Luau |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.