Skip to content

Commit 1539128

Browse files
committed
RequirementMachine: Move getGenericParamIndex() to RewriteContext
1 parent 8b99812 commit 1539128

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

lib/AST/RequirementMachine/InterfaceType.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ Type PropertyMap::getRelativeTypeForTerm(
393393
/// have a depth of 0, and an index into an array of substitution terms.
394394
///
395395
/// See RewriteSystemBuilder::getConcreteSubstitutionSchema().
396-
static unsigned getGenericParamIndex(Type type) {
396+
unsigned RewriteContext::getGenericParamIndex(Type type) {
397397
auto *paramTy = type->castTo<GenericTypeParamType>();
398398
assert(paramTy->getDepth() == 0);
399399
return paramTy->getIndex();
@@ -472,7 +472,7 @@ Type PropertyMap::getTypeFromSubstitutionSchema(
472472

473473
return schema.transformRec([&](Type t) -> Optional<Type> {
474474
if (t->is<GenericTypeParamType>()) {
475-
auto index = getGenericParamIndex(t);
475+
auto index = RewriteContext::getGenericParamIndex(t);
476476
auto substitution = substitutions[index];
477477

478478
// Prepend the prefix of the lookup key to the substitution.

lib/AST/RequirementMachine/RewriteContext.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,8 @@ class RewriteContext final {
162162
///
163163
//////////////////////////////////////////////////////////////////////////////
164164

165+
static unsigned getGenericParamIndex(Type type);
166+
165167
Term getTermForType(CanType paramType, const ProtocolDecl *proto);
166168

167169
MutableTerm getMutableTermForType(CanType paramType,

0 commit comments

Comments
 (0)