MCPcopy Index your code
hub / github.com/angular/angular / extractFieldValue

Function extractFieldValue

packages/compiler/src/typecheck/ops/signal_forms.ts:447–458  ·  view source on GitHub ↗

* Gets an expression that extracts the value of a field binding.

(expression: AST, tcb: Context, scope: Scope)

Source from the content-addressed store, hash-verified

445 * Gets an expression that extracts the value of a field binding.
446 */
447function extractFieldValue(expression: AST, tcb: Context, scope: Scope): TcbExpr {
448 // Unwraps the field, e.g. `[field]="f"` turns into `f()`.
449 const innerCall = new TcbExpr(tcbExpression(expression, tcb, scope).print() + '()');
450
451 // Note: we ignore diagnostics on this call, because it might not be callable
452 // (e.g. `undefined` is passed in). Whether the value conforms to `FieldTree` is
453 // checked using the common inputs op.
454 innerCall.markIgnoreDiagnostics();
455
456 // Extract the value from the field, e.g. `f().value()`.
457 return new TcbExpr(`${innerCall.print()}.value()`);
458}
459
460/**
461 * Gets an expression that extracts the value signal of a field binding (without calling it).

Callers 1

executeMethod · 0.85

Calls 3

printMethod · 0.95
markIgnoreDiagnosticsMethod · 0.95
tcbExpressionFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…