mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
Angular's null-safe access operators differ from Javascript's built-in semantics, in that they short-circuit to `null` instead of `undefined`. This necessitates providing a custom transformation, instead of relying on Typescript or Javascript itseld. The old TemplateDefinitionBuilder uses a top-down approach based on the Visitor pattern, in which it recursively extracts the left-most safe access, and hoists it to a null check at the top. See `expression_converter.ts` for details. In this commit, we replace that approach with a new bottom-up algorithm, as part of the template pipeline. This requires an intermediate expression type to represent the not-yet-expanded ternary operators, and is split into its own pass. Null-safe function calls are not yet implemented, since they will rely on a future temporary variable allocation pass. Co-authored-by: Alex Rickabaugh <alxhub@users.noreply.github.com> PR Close #50594 |
||
|---|---|---|
| .. | ||
| compliance | ||
| ngtsc | ||
| BUILD.bazel | ||
| downlevel_decorators_transform_spec.ts | ||
| extract_i18n_spec.ts | ||
| mocks.ts | ||
| perform_compile_spec.ts | ||
| perform_watch_spec.ts | ||
| test_support.ts | ||
| typescript_support_spec.ts | ||
| version_helpers_spec.ts | ||