(node, transformer, continuationArgName)
| 151640 | return createSynthIdentifier(renamedPrevArg); |
| 151641 | } |
| 151642 | function getPossibleNameForVarDecl(node, transformer, continuationArgName) { |
| 151643 | var possibleNameForVarDecl; |
| 151644 | // If there is another call in the chain after the .catch() or .finally() we are transforming, we will need to save the result of both paths |
| 151645 | // (try block and catch/finally block). To do this, we will need to synthesize a variable that we were not aware of while we were adding |
| 151646 | // identifiers to the synthNamesMap. We will use the continuationArgName and then update the synthNamesMap with a new variable name for |
| 151647 | // the next transformation step |
| 151648 | if (continuationArgName && !shouldReturn(node, transformer)) { |
| 151649 | if (isSynthIdentifier(continuationArgName)) { |
| 151650 | possibleNameForVarDecl = continuationArgName; |
| 151651 | transformer.synthNamesMap.forEach(function (val, key) { |
| 151652 | if (val.identifier.text === continuationArgName.identifier.text) { |
| 151653 | var newSynthName = createUniqueSynthName(continuationArgName); |
| 151654 | transformer.synthNamesMap.set(key, newSynthName); |
| 151655 | } |
| 151656 | }); |
| 151657 | } |
| 151658 | else { |
| 151659 | possibleNameForVarDecl = createSynthIdentifier(ts.factory.createUniqueName("result", 16 /* GeneratedIdentifierFlags.Optimistic */), continuationArgName.types); |
| 151660 | } |
| 151661 | // We are about to write a 'let' variable declaration, but `transformExpression` for both |
| 151662 | // the try block and catch/finally block will assign to this name. Setting this flag indicates |
| 151663 | // that future assignments should be written as `name = value` instead of `const name = value`. |
| 151664 | declareSynthIdentifier(possibleNameForVarDecl); |
| 151665 | } |
| 151666 | return possibleNameForVarDecl; |
| 151667 | } |
| 151668 | function finishCatchOrFinallyTransform(node, transformer, tryStatement, possibleNameForVarDecl, continuationArgName) { |
| 151669 | var statements = []; |
| 151670 | // In order to avoid an implicit any, we will synthesize a type for the declaration using the unions of the types of both paths (try block and catch block) |
no test coverage detected