@@ -4367,7 +4367,7 @@ class ApplyExpr : public Expr {
43674367 // / Is this application _implicitly_ required to be a throwing call?
43684368 // / This can happen if the function is actually a proxy function invocation,
43694369 // / 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
43714371 // / issues reported by the transport, regardless if the actual target function
43724372 // / can throw.
43734373 bool implicitlyThrows () const {
@@ -5562,24 +5562,43 @@ class KeyPathExpr : public Expr {
55625562private:
55635563 llvm::MutableArrayRef<Component> Components;
55645564
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);
55725568
5569+ // / Create a key path with unresolved root and path expressions.
55735570 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);
55835602
55845603 SourceLoc getLoc () const { return StartLoc; }
55855604 SourceRange getSourceRange () const { return SourceRange (StartLoc, EndLoc); }
@@ -5592,10 +5611,9 @@ class KeyPathExpr : public Expr {
55925611 return Components;
55935612 }
55945613
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);
55995617
56005618 // / Indicates if the key path expression is composed by a single invalid
56015619 // / component. e.g. missing component `\Root`
0 commit comments