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

Function visitArrowFunctionExpr

packages/compiler/src/output/abstract_emitter.ts:452–480  ·  view source on GitHub ↗
(ast: o.ArrowFunctionExpr, ctx: EmitterVisitorContext)

Source from the content-addressed store, hash-verified

450 }
451
452 visitArrowFunctionExpr(ast: o.ArrowFunctionExpr, ctx: EmitterVisitorContext): void {
453 this.printLeadingComments(ast, ctx);
454 ctx.print(ast, '(');
455 this.visitParams(ast.params, ctx);
456 ctx.print(ast, ')');
457 ast.type?.visitType(this, ctx);
458 ctx.print(ast, ' => ');
459
460 if (Array.isArray(ast.body)) {
461 ctx.print(ast, `{`);
462 ctx.println(ast);
463 ctx.incIndent();
464 this.visitAllStatements(ast.body, ctx);
465 ctx.decIndent();
466 ctx.println(ast, `}`);
467 } else {
468 const shouldParenthesize = this.shouldParenthesize(ast.body, ast);
469
470 if (shouldParenthesize) {
471 ctx.print(ast, '(');
472 }
473
474 ast.body.visitExpression(this, ctx);
475
476 if (shouldParenthesize) {
477 ctx.print(ast, ')');
478 }
479 }
480 }
481
482 visitDeclareFunctionStmt(stmt: o.DeclareFunctionStmt, ctx: EmitterVisitorContext): void {
483 this.printLeadingComments(stmt, ctx);

Callers

nothing calls this directly

Calls 8

isArrayMethod · 0.80
printlnMethod · 0.80
visitAllStatementsMethod · 0.80
printMethod · 0.45
visitTypeMethod · 0.45
incIndentMethod · 0.45
decIndentMethod · 0.45
visitExpressionMethod · 0.45

Tested by

no test coverage detected