angular/packages/compiler/src/render3
Pete Bacon Darwin 393efa54e6 fix(compiler): ensure that partially compiled queries can handle forward references (#44113)
When a partially compiled component or directive is "linked" in JIT mode, the body
of its declaration is evaluated by the JavaScript runtime. If a class is referenced
in a query (e.g. `ViewQuery` or `ContentQuery`) but its definition is later in the
file, then the reference must be wrapped in a `forwardRef()` call.

Previously, query predicates were not wrapped correctly in partial declarations
causing the code to crash at runtime. In AOT mode, this code is never evaluated
but instead transformed as part of the build, so this bug did not become apparent
until Angular Material started running JIT mode tests on its distributable output.

This change fixes this problem by noting when queries are wrapped in `forwardRef()`
calls and ensuring that this gets passed through to partial compilation declarations
and then suitably stripped during linking.

See https://github.com/angular/components/pull/23882 and https://github.com/angular/components/issues/23907

PR Close #44113
2021-11-10 18:25:16 +00:00
..
partial fix(compiler): ensure that partially compiled queries can handle forward references (#44113) 2021-11-10 18:25:16 +00:00
view fix(compiler): ensure that partially compiled queries can handle forward references (#44113) 2021-11-10 18:25:16 +00:00
r3_ast.ts refactor(compiler-cli): visit inputs and outputs for elements and templates (#42984) 2021-08-10 15:55:49 -07:00
r3_class_metadata_compiler.ts refactor(compiler-cli): introduce declaration function to declare class metadata (#41200) 2021-04-12 10:41:17 -07:00
r3_factory.ts refactor(compiler): remove cyclic dependencies (#43129) 2021-08-16 13:07:23 -07:00
r3_identifiers.ts refactor(compiler-cli): introduce declaration function to declare class metadata (#41200) 2021-04-12 10:41:17 -07:00
r3_injector_compiler.ts refactor(compiler): use ɵɵInjectorDeclaration rather than ɵɵInjectorDef in compiled output (#41119) 2021-03-22 08:57:18 -07:00
r3_jit.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
r3_module_compiler.ts refactor(core): rename ...WithMeta types to ...Declaration and alias to unknown (#41119) 2021-03-22 08:57:18 -07:00
r3_pipe_compiler.ts refactor(core): rename ...WithMeta types to ...Declaration and alias to unknown (#41119) 2021-03-22 08:57:18 -07:00
r3_template_transform.ts refactor(compiler): option to include html comments in ParsedTemplate (#41251) 2021-03-29 15:16:26 -07:00
util.ts fix(compiler): ensure that partially compiled queries can handle forward references (#44113) 2021-11-10 18:25:16 +00:00