@@ -4367,7 +4367,7 @@ class ApplyExpr : public Expr {
4367
4367
// / Is this application _implicitly_ required to be a throwing call?
4368
4368
// / This can happen if the function is actually a proxy function invocation,
4369
4369
// / which may throw, regardless of the target function throwing, e.g.
4370
- // / a distributed function call on a 'remote' actor, may throw due to network
4370
+ // / a distributed instance method call on a 'remote' actor, may throw due to network
4371
4371
// / issues reported by the transport, regardless if the actual target function
4372
4372
// / can throw.
4373
4373
bool implicitlyThrows () const {
@@ -5562,24 +5562,43 @@ class KeyPathExpr : public Expr {
5562
5562
private:
5563
5563
llvm::MutableArrayRef<Component> Components;
5564
5564
5565
- public:
5566
- // / Create a new #keyPath expression.
5567
- KeyPathExpr (ASTContext &C,
5568
- SourceLoc keywordLoc, SourceLoc lParenLoc,
5569
- ArrayRef<Component> components,
5570
- SourceLoc rParenLoc,
5571
- bool isImplicit = false );
5565
+ KeyPathExpr (SourceLoc startLoc, Expr *parsedRoot, Expr *parsedPath,
5566
+ SourceLoc endLoc, bool hasLeadingDot, bool isObjC,
5567
+ bool isImplicit);
5572
5568
5569
+ // / Create a key path with unresolved root and path expressions.
5573
5570
KeyPathExpr (SourceLoc backslashLoc, Expr *parsedRoot, Expr *parsedPath,
5574
- bool hasLeadingDot, bool isImplicit = false )
5575
- : Expr(ExprKind::KeyPath, isImplicit), StartLoc(backslashLoc),
5576
- EndLoc (parsedPath ? parsedPath->getEndLoc () : parsedRoot->getEndLoc()),
5577
- ParsedRoot(parsedRoot), ParsedPath(parsedPath),
5578
- HasLeadingDot(hasLeadingDot) {
5579
- assert ((parsedRoot || parsedPath) &&
5580
- " keypath must have either root or path" );
5581
- Bits.KeyPathExpr .IsObjC = false ;
5582
- }
5571
+ bool hasLeadingDot, bool isImplicit);
5572
+
5573
+ // / Create a key path with components.
5574
+ KeyPathExpr (ASTContext &ctx, SourceLoc startLoc,
5575
+ ArrayRef<Component> components, SourceLoc endLoc, bool isObjC,
5576
+ bool isImplicit);
5577
+
5578
+ public:
5579
+ // / Create a new parsed Swift key path expression.
5580
+ static KeyPathExpr *createParsed (ASTContext &ctx, SourceLoc backslashLoc,
5581
+ Expr *parsedRoot, Expr *parsedPath,
5582
+ bool hasLeadingDot);
5583
+
5584
+ // / Create a new parsed #keyPath expression.
5585
+ static KeyPathExpr *createParsedPoundKeyPath (ASTContext &ctx,
5586
+ SourceLoc keywordLoc,
5587
+ SourceLoc lParenLoc,
5588
+ ArrayRef<Component> components,
5589
+ SourceLoc rParenLoc);
5590
+
5591
+ // / Create an implicit Swift key path expression with a set of resolved
5592
+ // / components.
5593
+ static KeyPathExpr *createImplicit (ASTContext &ctx, SourceLoc backslashLoc,
5594
+ ArrayRef<Component> components,
5595
+ SourceLoc endLoc);
5596
+
5597
+ // / Create an implicit Swift key path expression with a root and path
5598
+ // / expression to be resolved.
5599
+ static KeyPathExpr *createImplicit (ASTContext &ctx, SourceLoc backslashLoc,
5600
+ Expr *parsedRoot, Expr *parsedPath,
5601
+ bool hasLeadingDot);
5583
5602
5584
5603
SourceLoc getLoc () const { return StartLoc; }
5585
5604
SourceRange getSourceRange () const { return SourceRange (StartLoc, EndLoc); }
@@ -5592,10 +5611,9 @@ class KeyPathExpr : public Expr {
5592
5611
return Components;
5593
5612
}
5594
5613
5595
- // / Resolve the components of an un-type-checked expr. This copies over the
5596
- // / components from the argument array.
5597
- void resolveComponents (ASTContext &C,
5598
- ArrayRef<Component> resolvedComponents);
5614
+ // / Set the key path components. This copies over the components from the
5615
+ // / argument array.
5616
+ void setComponents (ASTContext &C, ArrayRef<Component> newComponents);
5599
5617
5600
5618
// / Indicates if the key path expression is composed by a single invalid
5601
5619
// / component. e.g. missing component `\Root`
0 commit comments