* Enters the `catch` clause of a generated `try` statement. * * @param variable The catch variable.
(variable)
| 103501 | * @param variable The catch variable. |
| 103502 | */ |
| 103503 | function beginCatchBlock(variable) { |
| 103504 | ts.Debug.assert(peekBlockKind() === 0 /* CodeBlockKind.Exception */); |
| 103505 | // generated identifiers should already be unique within a file |
| 103506 | var name; |
| 103507 | if (ts.isGeneratedIdentifier(variable.name)) { |
| 103508 | name = variable.name; |
| 103509 | hoistVariableDeclaration(variable.name); |
| 103510 | } |
| 103511 | else { |
| 103512 | var text = ts.idText(variable.name); |
| 103513 | name = declareLocal(text); |
| 103514 | if (!renamedCatchVariables) { |
| 103515 | renamedCatchVariables = new ts.Map(); |
| 103516 | renamedCatchVariableDeclarations = []; |
| 103517 | context.enableSubstitution(79 /* SyntaxKind.Identifier */); |
| 103518 | } |
| 103519 | renamedCatchVariables.set(text, true); |
| 103520 | renamedCatchVariableDeclarations[ts.getOriginalNodeId(variable)] = name; |
| 103521 | } |
| 103522 | var exception = peekBlock(); |
| 103523 | ts.Debug.assert(exception.state < 1 /* ExceptionBlockState.Catch */); |
| 103524 | var endLabel = exception.endLabel; |
| 103525 | emitBreak(endLabel); |
| 103526 | var catchLabel = defineLabel(); |
| 103527 | markLabel(catchLabel); |
| 103528 | exception.state = 1 /* ExceptionBlockState.Catch */; |
| 103529 | exception.catchVariable = name; |
| 103530 | exception.catchLabel = catchLabel; |
| 103531 | emitAssignment(name, factory.createCallExpression(factory.createPropertyAccessExpression(state, "sent"), /*typeArguments*/ undefined, [])); |
| 103532 | emitNop(); |
| 103533 | } |
| 103534 | /** |
| 103535 | * Enters the `finally` block of a generated `try` statement. |
| 103536 | */ |
no test coverage detected
searching dependent graphs…