angular-docs-cn/packages/language-service/ivy
Alex Rickabaugh deacc741e0 fix(compiler-cli): ensure the compiler tracks `ts.Program`s correctly (#41291)
`NgCompiler` previously had a notion of the "next" `ts.Program`, which
served two purposes:

* it allowed a client using the `ts.createProgram` API to query for the
  latest program produced by the previous `NgCompiler`, as a starting
  point for building the _next_ program that incorporated any new user
  changes.

* it allowed the old `NgCompiler` to be queried for the `ts.Program` on
  which all prior state is based, which is needed to compute the delta
  from the new program to ultimately determine how much of the prior
  state can be reused.

This system contained a flaw: it relied on the `NgCompiler` knowing when
the `ts.Program` would be changed. This works fine for changes that
originate in `NgCompiler` APIs, but a client of the `TemplateTypeChecker`
may use that API in ways that create new `ts.Program`s without the
`NgCompiler`'s knowledge. This caused the `NgCompiler`'s concept of the
"next" program to get out of sync, causing incorrectness in future
incremental analysis.

This refactoring cleans up the compiler's `ts.Program` management in
several ways:

* `TypeCheckingProgramStrategy`, the API which controls `ts.Program`
  updating, is renamed to the `ProgramDriver` and extracted to a separate
  ngtsc package.

* It loses its responsibility of determining component shim filenames. That
  functionality now lives exclusively in the template type-checking package.

* The "next" `ts.Program` concept is renamed to the "current" program, as
  the "next" name was misleading in several ways.

* `NgCompiler` now wraps the `ProgramDriver` used in the
  `TemplateTypeChecker` to know when a new `ts.Program` is created,
  regardless of which API drove the creation, which actually fixes the bug.

PR Close #41291
2021-04-08 10:20:38 -07:00
..
test fix(compiler-cli): Allow analysis to continue with invalid style url (#41403) 2021-04-07 09:42:21 -07:00
testing feat(language-service): add perf tracing to LanguageService (#41319) 2021-03-31 10:03:53 -07:00
BUILD.bazel fix(compiler-cli): ensure the compiler tracks `ts.Program`s correctly (#41291) 2021-04-08 10:20:38 -07:00
adapters.ts perf(language-service): update NgCompiler via resource-only path when able (#40585) 2021-02-02 16:24:56 -08:00
attribute_completions.ts fix(language-service): Only provide Angular property completions in templates (#41278) 2021-04-01 11:37:30 -07:00
compiler_factory.ts fix(compiler-cli): ensure the compiler tracks `ts.Program`s correctly (#41291) 2021-04-08 10:20:38 -07:00
completions.ts fix(compiler-cli): ensure the compiler tracks `ts.Program`s correctly (#41291) 2021-04-08 10:20:38 -07:00
definitions.ts fix(compiler-cli): ensure the compiler tracks `ts.Program`s correctly (#41291) 2021-04-08 10:20:38 -07:00
display_parts.ts feat(language-service): complete attributes on elements (#40032) 2020-12-14 12:08:41 -08:00
language_service.ts fix(compiler-cli): ensure the compiler tracks `ts.Program`s correctly (#41291) 2021-04-08 10:20:38 -07:00
quick_info.ts fix(compiler-cli): ensure the compiler tracks `ts.Program`s correctly (#41291) 2021-04-08 10:20:38 -07:00
references.ts fix(compiler-cli): ensure the compiler tracks `ts.Program`s correctly (#41291) 2021-04-08 10:20:38 -07:00
template_target.ts refactor(language-service): Have TemplateTarget recognize two way bindings (#40185) 2021-01-07 13:18:38 -08:00
ts_plugin.ts fix(language-service): Add plugin option to force strictTemplates (#41062) 2021-03-03 09:48:06 -08:00
ts_utils.ts perf(language-service): short-circuit LS operations (#40946) 2021-02-22 13:19:09 -08:00
utils.ts fix(compiler-cli): ensure the compiler tracks `ts.Program`s correctly (#41291) 2021-04-08 10:20:38 -07:00