perf(ivy): eagerly parse the template twice during analysis (#34334)
A quirk of the Angular template parser is that when parsing templates in the "default" mode, with options specified by the user, the source mapping information in the template AST may be inaccurate. As a result, the compiler parses the template twice: once for "emit" and once to produce an AST with accurate sourcemaps for diagnostic production. Previously, only the first parse was performed during analysis. The second parse occurred during the template type-checking phase, just in time to produce the template type-checking file. However, with the reuse of analysis results during incremental builds, it makes more sense to do the diagnostic parse eagerly during analysis so that the work isn't unnecessarily repeated in subsequent builds. This commit refactors the `ComponentDecoratorHandler` to do both parses eagerly, which actually cleans up some complexity around template parsing as well. PR Close #34334
This commit is contained in:

committed by
Kara Erickson

parent
adb0663d58
commit
fb4a11a859
@ -93,8 +93,8 @@ export class DecorationAnalyzer {
|
||||
/* i18nUseExternalIds */ true, this.bundle.enableI18nLegacyMessageIdFormat,
|
||||
this.moduleResolver, this.cycleAnalyzer, this.refEmitter, NOOP_DEFAULT_IMPORT_RECORDER,
|
||||
NOOP_DEPENDENCY_TRACKER, /* annotateForClosureCompiler */ false),
|
||||
// See the note in ngtsc about why this cast is needed.
|
||||
// clang-format off
|
||||
// See the note in ngtsc about why this cast is needed.
|
||||
new DirectiveDecoratorHandler(
|
||||
this.reflectionHost, this.evaluator, this.fullRegistry, NOOP_DEFAULT_IMPORT_RECORDER,
|
||||
this.isCore, /* annotateForClosureCompiler */ false) as DecoratorHandler<unknown, unknown, unknown>,
|
||||
|
Reference in New Issue
Block a user