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

Method executeOp

packages/compiler/src/typecheck/ops/scope.ts:454–475  ·  view source on GitHub ↗

* Execute a particular `TcbOp` in the `opQueue`. * * This method replaces the operation in the `opQueue` with the result of execution (once done) * and also protects against a circular dependency from the operation to itself by temporarily * setting the operation's result to a special ex

(opIndex: number, skipOptional: boolean)

Source from the content-addressed store, hash-verified

452 * setting the operation's result to a special expression.
453 */
454 private executeOp(opIndex: number, skipOptional: boolean): TcbExpr | null {
455 const op = this.opQueue[opIndex];
456 if (!(op instanceof TcbOp)) {
457 return op === null ? null : new TcbExpr(op.print(true /* ignoreComments */));
458 }
459
460 if (skipOptional && op.optional) {
461 return null;
462 }
463
464 // Set the result of the operation in the queue to its circular fallback. If executing this
465 // operation results in a circular dependency, this will prevent an infinite loop and allow for
466 // the resolution of such cycles.
467 this.opQueue[opIndex] = op.circularFallback();
468 let res = op.execute();
469 if (res !== null) {
470 res = new TcbExpr(res.print(true /* ignoreComments */));
471 }
472 // Once the operation has finished executing, it's safe to cache the real result.
473 this.opQueue[opIndex] = res;
474 return res;
475 }
476
477 private appendNode(node: Node): void {
478 if (node instanceof Element) {

Callers 2

renderMethod · 0.95
resolveOpMethod · 0.95

Calls 3

circularFallbackMethod · 0.80
executeMethod · 0.65
printMethod · 0.45

Tested by

no test coverage detected