mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Private constructor for tuple element kind keypath in AST
This commit is contained in:
committed by
Andrea Tomarelli
parent
d7324b977e
commit
bad2230ccd
@@ -2185,27 +2185,19 @@ KeyPathExpr::Component::Component(ASTContext *ctxForCopyingLabels,
|
||||
Expr *indexExpr,
|
||||
ArrayRef<Identifier> subscriptLabels,
|
||||
ArrayRef<ProtocolConformanceRef> indexHashables,
|
||||
unsigned tupleIndex,
|
||||
Kind kind,
|
||||
Type type,
|
||||
SourceLoc loc)
|
||||
: Decl(decl), SubscriptIndexExpr(indexExpr), KindValue(kind),
|
||||
ComponentType(type), Loc(loc)
|
||||
{
|
||||
assert(kind != Kind::TupleElement || subscriptLabels.empty());
|
||||
assert(subscriptLabels.size() == indexHashables.size()
|
||||
|| indexHashables.empty());
|
||||
SubscriptLabelsData = subscriptLabels.data();
|
||||
SubscriptHashableConformancesData = indexHashables.empty()
|
||||
? nullptr : indexHashables.data();
|
||||
|
||||
if (kind == Kind::TupleElement) {
|
||||
assert(subscriptLabels.empty()
|
||||
&& "subscript labels not empty for tuple element");
|
||||
|
||||
TupleIndex = tupleIndex;
|
||||
} else {
|
||||
SubscriptSize = subscriptLabels.size();
|
||||
}
|
||||
SubscriptSize = subscriptLabels.size();
|
||||
}
|
||||
|
||||
KeyPathExpr::Component
|
||||
@@ -2214,7 +2206,7 @@ KeyPathExpr::Component::forSubscriptWithPrebuiltIndexExpr(
|
||||
Type elementType, SourceLoc loc,
|
||||
ArrayRef<ProtocolConformanceRef> indexHashables) {
|
||||
return Component(&elementType->getASTContext(),
|
||||
subscript, index, labels, indexHashables, 0,
|
||||
subscript, index, labels, indexHashables,
|
||||
Kind::Subscript, elementType, loc);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user