angular/packages/compiler-cli/test/compliance/test_helpers
Paul Gschwendtner 35ee10e357 refactor(compiler-cli): support generation of signal-based queries (#53978)
This commit introduces the compiler output generation for signal-based
queries. Signal-based queries will have new creation-mode instructions
and update instructions to advance the current query indices in the
global shared context.

An output like the following is the expected output for signal-based
queries:

```
i0.ɵɵdefineComponent({
  viewQuery: function App_Query(rf, ctx) {
      if (rf & 1) {
          i0.ɵɵviewQuery(ctx.d, _c0, 5);
          i0.ɵɵviewQuerySignal(ctx.ds1, _c0, 5);
          i0.ɵɵviewQuerySignal(ctx.ds2, _c0, 5);
      }
      if (rf & 2) {
          let _t;
          // only change-detected queries need explicit refresh
          i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.d = _t.first);
          // we bump up current query index by 2 positions since there are 2 signal-based queries
          i0.ɵɵqueryAdvance(2);
      }
      …
  },
  …
});

```

Note: For now, the collapsing of multiple advance instructions is not
implemented. This will be a follow-up.

Note 2: A couple of query helpers are now in their own file. This makes
it easier to focus on query-specific compiler code. The new function is
called `createQueryCreateCall`, which is a modified variant of the
existing function that previously only generated query parameters.

PR Close #53978
2024-01-23 10:24:36 +01:00
..
BUILD.bazel test(compiler): Prevent back-sliding on already passing template pipeline tests (#50582) 2023-06-12 18:25:41 +02:00
check_errors.ts test(compiler-cli): log unexpected compilation errors in compliance test runner (#39862) 2020-12-02 14:56:38 -08:00
check_expectations.ts build: re-enable linker compliance tests (#53571) 2024-01-04 12:07:13 -08:00
compile_test.ts feat(core): add support for TypeScript 5.0 (#49126) 2023-02-28 08:24:47 -08:00
di_checks.ts fix(compiler-cli): remove unnecessary escaping in regex expressions (#51554) 2023-08-29 21:52:33 +00:00
expect_emit.ts refactor: replace deprecated String.prototype.substr() (#45397) 2022-03-24 11:48:09 -07:00
expected_file_macros.ts refactor(compiler-cli): support generation of signal-based queries (#53978) 2024-01-23 10:24:36 +01:00
function_checks.ts test(compiler-cli): migrate template compliance tests (#39871) 2020-12-01 14:58:11 -08:00
get_compliance_tests.ts test(compiler): allow alternate expected file for template pipeline (#51100) 2023-08-01 13:45:34 -07:00
golden_partials.ts test(compiler-cli): ensure that golden partial files are parsed accurately (#39939) 2020-12-07 16:21:02 -08:00
i18n_checks.ts test(compiler): fix broken integrity check (#51751) 2023-09-13 10:48:32 -07:00
i18n_helpers.ts refactor(compiler): add original_code to goog.getMsg() options (#45606) 2022-04-18 09:26:16 -07:00
sourcemap_helpers.ts build: re-enable linker compliance tests (#53571) 2024-01-04 12:07:13 -08:00
test_runner.ts build: re-enable linker compliance tests (#53571) 2024-01-04 12:07:13 -08:00