* Gets an expression that extracts the value of a field binding.
(expression: AST, tcb: Context, scope: Scope)
| 445 | * Gets an expression that extracts the value of a field binding. |
| 446 | */ |
| 447 | function 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). |
no test coverage detected
searching dependent graphs…