@@ -3909,9 +3909,8 @@ bool MissingArgumentsFailure::diagnoseAsError() {
39093909 unsigned numArguments = 0 ;
39103910 bool hasTrailingClosure = false ;
39113911
3912- auto *rawAnchor = getRawAnchor ().get <const Expr *>();
39133912 std::tie (fnExpr, argExpr, numArguments, hasTrailingClosure) =
3914- getCallInfo (const_cast <Expr *>(rawAnchor ));
3913+ getCallInfo (getRawAnchor ( ));
39153914
39163915 // TODO(diagnostics): We should be able to suggest this fix-it
39173916 // unconditionally.
@@ -3987,7 +3986,7 @@ bool MissingArgumentsFailure::diagnoseSingleMissingArgument() const {
39873986 bool hasTrailingClosure = false ;
39883987
39893988 std::tie (fnExpr, argExpr, insertableEndIdx, hasTrailingClosure) =
3990- getCallInfo (const_cast <Expr *>( anchor. get < const Expr *>()) );
3989+ getCallInfo (anchor);
39913990
39923991 if (!argExpr)
39933992 return false ;
@@ -4293,17 +4292,17 @@ bool MissingArgumentsFailure::isMisplacedMissingArgument(
42934292}
42944293
42954294std::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)) {
42984297 return std::make_tuple (call->getFn (), call->getArg (),
42994298 call->getNumArguments (), call->hasTrailingClosure ());
4300- } else if (auto *UME = dyn_cast <UnresolvedMemberExpr>(anchor)) {
4299+ } else if (auto *UME = getAsExpr <UnresolvedMemberExpr>(anchor)) {
43014300 return std::make_tuple (UME, UME->getArgument (), UME->getNumArguments (),
43024301 UME->hasTrailingClosure ());
4303- } else if (auto *SE = dyn_cast <SubscriptExpr>(anchor)) {
4302+ } else if (auto *SE = getAsExpr <SubscriptExpr>(anchor)) {
43044303 return std::make_tuple (SE, SE->getIndex (), SE->getNumArguments (),
43054304 SE->hasTrailingClosure ());
4306- } else if (auto *OLE = dyn_cast <ObjectLiteralExpr>(anchor)) {
4305+ } else if (auto *OLE = getAsExpr <ObjectLiteralExpr>(anchor)) {
43074306 return std::make_tuple (OLE, OLE->getArg (), OLE->getNumArguments (),
43084307 OLE->hasTrailingClosure ());
43094308 }
0 commit comments