MCPcopy Create free account
hub / github.com/angular/angular / execute

Method execute

packages/compiler/src/typecheck/ops/boundary.ts:32–56  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

30 }
31
32 override execute(): null {
33 const checkBody = this.tcb.env.config.checkControlFlowBodies;
34
35 // 1. Render try body
36 const tryBodyScope = this.scope.createChildScope(
37 this.scope,
38 null,
39 checkBody ? this.block.children : [],
40 null,
41 );
42 const tryBlockStr = `{\n${getStatementsBlock(tryBodyScope.render())}}`;
43
44 // 2. Render catch clause if there are error blocks
45 if (this.block.errorBlocks.length > 0) {
46 // Create an inner block where we execute the chain of error branches
47 const innerCatchStatements = this.generateCatchBranch(0);
48 const catchBlockStr = `{\n${getStatementsBlock(innerCatchStatements)}}`;
49
50 const tryStatement = new TcbExpr(`try ${tryBlockStr} catch (err) ${catchBlockStr}`);
51 this.scope.addStatement(tryStatement);
52 } else {
53 this.scope.addStatement(new TcbExpr(tryBlockStr));
54 }
55 return null;
56 }
57
58 private generateCatchBranch(index: number): TcbExpr[] {
59 const errorBlock = this.block.errorBlocks[index];

Callers

nothing calls this directly

Calls 5

generateCatchBranchMethod · 0.95
getStatementsBlockFunction · 0.90
createChildScopeMethod · 0.80
addStatementMethod · 0.80
renderMethod · 0.65

Tested by

no test coverage detected