@@ -3909,9 +3909,8 @@ bool MissingArgumentsFailure::diagnoseAsError() {
3909
3909
unsigned numArguments = 0 ;
3910
3910
bool hasTrailingClosure = false ;
3911
3911
3912
- auto *rawAnchor = getRawAnchor ().get <const Expr *>();
3913
3912
std::tie (fnExpr, argExpr, numArguments, hasTrailingClosure) =
3914
- getCallInfo (const_cast <Expr *>(rawAnchor ));
3913
+ getCallInfo (getRawAnchor ( ));
3915
3914
3916
3915
// TODO(diagnostics): We should be able to suggest this fix-it
3917
3916
// unconditionally.
@@ -3987,7 +3986,7 @@ bool MissingArgumentsFailure::diagnoseSingleMissingArgument() const {
3987
3986
bool hasTrailingClosure = false ;
3988
3987
3989
3988
std::tie (fnExpr, argExpr, insertableEndIdx, hasTrailingClosure) =
3990
- getCallInfo (const_cast <Expr *>( anchor. get < const Expr *>()) );
3989
+ getCallInfo (anchor);
3991
3990
3992
3991
if (!argExpr)
3993
3992
return false ;
@@ -4293,17 +4292,17 @@ bool MissingArgumentsFailure::isMisplacedMissingArgument(
4293
4292
}
4294
4293
4295
4294
std::tuple<Expr *, Expr *, unsigned , bool >
4296
- MissingArgumentsFailure::getCallInfo (Expr * anchor) const {
4297
- if (auto *call = dyn_cast <CallExpr>(anchor)) {
4295
+ MissingArgumentsFailure::getCallInfo (TypedNode anchor) const {
4296
+ if (auto *call = getAsExpr <CallExpr>(anchor)) {
4298
4297
return std::make_tuple (call->getFn (), call->getArg (),
4299
4298
call->getNumArguments (), call->hasTrailingClosure ());
4300
- } else if (auto *UME = dyn_cast <UnresolvedMemberExpr>(anchor)) {
4299
+ } else if (auto *UME = getAsExpr <UnresolvedMemberExpr>(anchor)) {
4301
4300
return std::make_tuple (UME, UME->getArgument (), UME->getNumArguments (),
4302
4301
UME->hasTrailingClosure ());
4303
- } else if (auto *SE = dyn_cast <SubscriptExpr>(anchor)) {
4302
+ } else if (auto *SE = getAsExpr <SubscriptExpr>(anchor)) {
4304
4303
return std::make_tuple (SE, SE->getIndex (), SE->getNumArguments (),
4305
4304
SE->hasTrailingClosure ());
4306
- } else if (auto *OLE = dyn_cast <ObjectLiteralExpr>(anchor)) {
4305
+ } else if (auto *OLE = getAsExpr <ObjectLiteralExpr>(anchor)) {
4307
4306
return std::make_tuple (OLE, OLE->getArg (), OLE->getNumArguments (),
4308
4307
OLE->hasTrailingClosure ());
4309
4308
}
0 commit comments