Skip to content

Commit 2f3b2df

Browse files
committed
[GSB] Plumb generic params through getDependentType() fully.
This allows us to eliminate `getBuilder()`.
1 parent 214f9d5 commit 2f3b2df

File tree

2 files changed

+118
-79
lines changed

2 files changed

+118
-79
lines changed

include/swift/AST/GenericSignatureBuilder.h

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -547,6 +547,10 @@ class GenericSignatureBuilder {
547547
const RequirementSource *source)> f);
548548

549549
public:
550+
/// Retrieve the generic parameters used to describe the generic
551+
/// signature being built.
552+
ArrayRef<GenericTypeParamType *> getGenericParams() const;
553+
550554
/// \brief Add a new generic parameter for which there may be requirements.
551555
void addGenericParameter(GenericTypeParamDecl *GenericParam);
552556

@@ -1455,7 +1459,8 @@ struct GenericSignatureBuilder::Constraint {
14551459
const RequirementSource *source;
14561460

14571461
/// Retrieve the dependent type describing the subject of the constraint.
1458-
Type getSubjectDependentType() const;
1462+
Type getSubjectDependentType(
1463+
ArrayRef<GenericTypeParamType *> genericParams) const;
14591464

14601465
/// Realizes and retrieves the potential archetype describing the
14611466
/// subject of the constraint.
@@ -1560,15 +1565,6 @@ class GenericSignatureBuilder::PotentialArchetype {
15601565
PotentialArchetype *getRepresentative() const;
15611566

15621567
private:
1563-
/// Retrieve the generic signature builder with which this archetype is
1564-
/// associated.
1565-
GenericSignatureBuilder *getBuilder() const {
1566-
const PotentialArchetype *pa = this;
1567-
while (auto parent = pa->getParent())
1568-
pa = parent;
1569-
return pa->parentOrBuilder.get<GenericSignatureBuilder *>();
1570-
}
1571-
15721568
// Replace the generic signature builder.
15731569
void replaceBuilder(GenericSignatureBuilder *builder) {
15741570
assert(parentOrBuilder.is<GenericSignatureBuilder *>());
@@ -1729,7 +1725,10 @@ class GenericSignatureBuilder::PotentialArchetype {
17291725

17301726
return false;
17311727
}
1732-
1728+
1729+
/// Retrieve the AST context in which this potential archetype resides.
1730+
ASTContext &getASTContext() const;
1731+
17331732
LLVM_ATTRIBUTE_DEPRECATED(
17341733
void dump() const,
17351734
"only for use within the debugger");

0 commit comments

Comments
 (0)