MCPcopy Index your code
hub / github.com/nodejs/node / beginCatchBlock

Function beginCatchBlock

test/fixtures/snapshot/typescript.js:103503–103533  ·  view source on GitHub ↗

* Enters the `catch` clause of a generated `try` statement. * * @param variable The catch variable.

(variable)

Source from the content-addressed store, hash-verified

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 */

Callers 1

Calls 11

peekBlockKindFunction · 0.85
hoistVariableDeclarationFunction · 0.85
declareLocalFunction · 0.85
peekBlockFunction · 0.85
emitBreakFunction · 0.85
defineLabelFunction · 0.85
markLabelFunction · 0.85
emitAssignmentFunction · 0.85
emitNopFunction · 0.85
assertMethod · 0.80
setMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…