refactor(compiler): support use of poisoned data as private compiler option (#57082)

This allows use of poisoned data for migrations. Right now, migrations
often enable this flag by creating some deeper structures of the
Angular compiler, but with this change it's easier to enable as a
private compiler option.

This is helpful for migrations, specifically the signal input migration
as it allows us to generate as much TCB code as possible, for reference
resolution.

PR Close #57082
This commit is contained in:
Paul Gschwendtner 2024-07-22 14:36:55 +00:00 committed by Andrew Scott
parent bf853b7c67
commit a22f1428b7
2 changed files with 8 additions and 1 deletions

View file

@ -37,6 +37,12 @@ export interface TestOnlyOptions {
*/
_enableTemplateTypeChecker?: boolean;
/**
* Whether components that are poisoned should still be processed.
* E.g. for generation of type check blocks and diagnostics.
*/
_compilePoisedComponents?: boolean;
/**
* An option to enable ngtsc's internal performance tracing.
*

View file

@ -454,8 +454,9 @@ export class NgCompiler {
private livePerfRecorder: ActivePerfRecorder,
) {
this.delegatingPerfRecorder = new DelegatingPerfRecorder(this.perfRecorder);
this.usePoisonedData = usePoisonedData || !!options._compilePoisedComponents;
this.enableTemplateTypeChecker =
enableTemplateTypeChecker || (options['_enableTemplateTypeChecker'] ?? false);
enableTemplateTypeChecker || !!options._enableTemplateTypeChecker;
// TODO(crisbeto): remove this flag and base `enableBlockSyntax` on the `angularCoreVersion`.
this.enableBlockSyntax = options['_enableBlockSyntax'] ?? true;
this.enableLetSyntax = options['_enableLetSyntax'] ?? true;