Skip to content

Commit c3e487c

Browse files
committed
Explicitly handle error case in fallback logic
I don't believe this case currently can come up, but leave it explicitly unhandled for now so we don't perform an erroneous transform if it ever comes up in the future.
1 parent b7de0be commit c3e487c

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

lib/IDE/Refactoring.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6416,9 +6416,10 @@ class AsyncConverter : private SourceEntityWalker {
64166416
}
64176417

64186418
if (DiagEngine.hadAnyError()) {
6419-
// Can only fallback when the results are params, in which case only
6420-
// the names are used (defaulted to the names of the params if none)
6421-
if (HandlerDesc.Type != HandlerType::PARAMS)
6419+
// For now, only fallback when the results are params with an error param,
6420+
// in which case only the names are used (defaulted to the names of the
6421+
// params if none).
6422+
if (HandlerDesc.Type != HandlerType::PARAMS || !HandlerDesc.HasError)
64226423
return;
64236424
DiagEngine.resetHadAnyError();
64246425

@@ -6429,7 +6430,7 @@ class AsyncConverter : private SourceEntityWalker {
64296430
addFallbackVars(CallbackParams, Blocks);
64306431
addDo();
64316432
addAwaitCall(CE, ArgList.ref(), Blocks.SuccessBlock, SuccessParams,
6432-
HandlerDesc, /*AddDeclarations=*/!HandlerDesc.HasError);
6433+
HandlerDesc, /*AddDeclarations*/ false);
64336434
addFallbackCatch(ErrParam);
64346435
OS << "\n";
64356436
convertNodes(NodesToPrint::inBraceStmt(CallbackBody));

0 commit comments

Comments
 (0)