@@ -4612,24 +4612,24 @@ class KeyPathExpr : public Expr {
4612
4612
Type ComponentType;
4613
4613
SourceLoc Loc;
4614
4614
4615
- explicit Component (DeclNameOrRef decl,
4615
+ explicit Component (ASTContext *ctxForCopyingLabels,
4616
+ DeclNameOrRef decl,
4616
4617
Expr *indexExpr,
4617
4618
ArrayRef<Identifier> subscriptLabels,
4618
4619
Kind kind,
4619
4620
Type type,
4620
- SourceLoc loc)
4621
- : Decl(decl), SubscriptIndexExprAndKind(indexExpr, kind),
4622
- SubscriptLabels(subscriptLabels),
4623
- ComponentType(type), Loc(loc)
4624
- {}
4621
+ SourceLoc loc);
4625
4622
4626
4623
public:
4627
- Component () : Component({}, nullptr , {}, Kind::Invalid, Type(), SourceLoc()) {}
4624
+ Component ()
4625
+ : Component(nullptr , {}, nullptr , {}, Kind::Invalid, Type(), SourceLoc())
4626
+ {}
4628
4627
4629
4628
// / Create an unresolved component for a property.
4630
4629
static Component forUnresolvedProperty (DeclName UnresolvedName,
4631
4630
SourceLoc Loc) {
4632
- return Component (UnresolvedName, nullptr , {},
4631
+ return Component (nullptr ,
4632
+ UnresolvedName, nullptr , {},
4633
4633
Kind::UnresolvedProperty,
4634
4634
Type (),
4635
4635
Loc);
@@ -4648,25 +4648,28 @@ class KeyPathExpr : public Expr {
4648
4648
// /
4649
4649
// / You shouldn't add new uses of this overload; use the one that takes a
4650
4650
// / list of index arguments.
4651
- static Component forUnresolvedSubscriptWithPrebuiltIndexExpr (Expr *index,
4651
+ static Component forUnresolvedSubscriptWithPrebuiltIndexExpr (
4652
+ ASTContext &context,
4653
+ Expr *index,
4652
4654
ArrayRef<Identifier> subscriptLabels,
4653
4655
SourceLoc loc) {
4654
4656
4655
- return Component ({}, index, subscriptLabels, Kind::UnresolvedSubscript,
4657
+ return Component (&context,
4658
+ {}, index, subscriptLabels, Kind::UnresolvedSubscript,
4656
4659
Type (), loc);
4657
4660
}
4658
4661
4659
4662
// / Create an unresolved optional force `!` component.
4660
4663
static Component forUnresolvedOptionalForce (SourceLoc BangLoc) {
4661
- return Component ({}, nullptr , {},
4664
+ return Component (nullptr , {}, nullptr , {},
4662
4665
Kind::OptionalForce,
4663
4666
Type (),
4664
4667
BangLoc);
4665
4668
}
4666
4669
4667
4670
// / Create an unresolved optional chain `?` component.
4668
4671
static Component forUnresolvedOptionalChain (SourceLoc QuestionLoc) {
4669
- return Component ({}, nullptr , {},
4672
+ return Component (nullptr , {}, nullptr , {},
4670
4673
Kind::OptionalChain,
4671
4674
Type (),
4672
4675
QuestionLoc);
@@ -4676,7 +4679,7 @@ class KeyPathExpr : public Expr {
4676
4679
static Component forProperty (ConcreteDeclRef property,
4677
4680
Type propertyType,
4678
4681
SourceLoc loc) {
4679
- return Component (property, nullptr , {},
4682
+ return Component (nullptr , property, nullptr , {},
4680
4683
Kind::Property,
4681
4684
propertyType,
4682
4685
loc);
@@ -4699,21 +4702,19 @@ class KeyPathExpr : public Expr {
4699
4702
// / list of index arguments.
4700
4703
static Component forSubscriptWithPrebuiltIndexExpr (
4701
4704
ConcreteDeclRef subscript, Expr *index, ArrayRef<Identifier> labels,
4702
- Type elementType, SourceLoc loc) {
4703
- return Component (subscript, index, {}, Kind::Subscript, elementType, loc);
4704
- }
4705
+ Type elementType, SourceLoc loc);
4705
4706
4706
4707
// / Create an optional-forcing `!` component.
4707
4708
static Component forOptionalForce (Type forcedType, SourceLoc bangLoc) {
4708
- return Component ({}, nullptr , {},
4709
+ return Component (nullptr , {}, nullptr , {},
4709
4710
Kind::OptionalForce, forcedType,
4710
4711
bangLoc);
4711
4712
}
4712
4713
4713
4714
// / Create an optional-chaining `?` component.
4714
4715
static Component forOptionalChain (Type unwrappedType,
4715
4716
SourceLoc questionLoc) {
4716
- return Component ({}, nullptr , {},
4717
+ return Component (nullptr , {}, nullptr , {},
4717
4718
Kind::OptionalChain, unwrappedType,
4718
4719
questionLoc);
4719
4720
}
@@ -4722,7 +4723,7 @@ class KeyPathExpr : public Expr {
4722
4723
// / syntax but may appear when the non-optional result of an optional chain
4723
4724
// / is implicitly wrapped.
4724
4725
static Component forOptionalWrap (Type wrappedType) {
4725
- return Component ({}, nullptr , {},
4726
+ return Component (nullptr , {}, nullptr , {},
4726
4727
Kind::OptionalWrap, wrappedType,
4727
4728
SourceLoc ());
4728
4729
}
0 commit comments