angular/packages/compiler-cli/src/ngtsc
JoostK fa0104017a refactor(compiler-cli): only use type constructors for directives with generic types (#38249)
Prior to this change, the template type checker would always use a
type-constructor to instantiate a directive. This type-constructor call
serves two purposes:

1. Infer any generic types for the directive instance from the inputs
   that are passed in.
2. Type check the inputs that are passed into the directive's inputs.

The first purpose is only relevant when the directive actually has any
generic types and using a type-constructor for these cases inhibits
a type-check performance penalty, as a type-constructor's signature is
quite complex and needs to be generated for each directive.

This commit refactors the generated type-check blocks to only generate
a type-constructor call for directives that have generic types. Type
checking of inputs is achieved by generating individual statements for
all inputs, using assignments into the directive's fields.

Even if a type-constructor is used for type-inference of generic types
will the input checking also be achieved using the individual assignment
statements. This is done to support the rework of the language service,
which will start to extract symbol information from the type-check
blocks.

As a future optimization, it may be possible to reduce the number of
inputs passed into a type-constructor to only those inputs that
contribute the the type-inference of the generics. As this is not a
necessity at the moment this is left as follow-up work.

Closes #38185

PR Close #38249
2020-08-11 09:55:48 -07:00
..
annotations refactor(compiler-cli): only use type constructors for directives with generic types (#38249) 2020-08-11 09:55:48 -07:00
core refactor(compiler-cli): efficient single-file type checking diagnostics (#38105) 2020-07-29 10:31:20 -07:00
cycles build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
diagnostics refactor(compiler-cli): allow program strategies to opt out of inlining (#38105) 2020-07-29 10:31:20 -07:00
entry_point refactor(compiler-cli): extract NgCompilerAdapter interface (#37118) 2020-06-03 13:29:44 -07:00
file_system fix(compiler-cli): ensure file_system handles mixed Windows drives (#37959) 2020-07-13 12:05:21 -07:00
imports refactor(core): add noSideEffects() as private export (#38320) 2020-08-06 09:02:16 -07:00
incremental refactor(compiler-cli): introduce the TemplateTypeChecker abstraction (#38105) 2020-07-29 10:31:20 -07:00
indexer build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
logging build(compiler-cli): fix bazel deps rules for ngtsc testing packages (#37977) 2020-07-08 12:05:22 -07:00
metadata refactor(compiler-cli): only use type constructors for directives with generic types (#38249) 2020-08-11 09:55:48 -07:00
modulewithproviders build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
partial_evaluator test(compiler-cli): disable DynamicValue diagnostic tests on Windows (#37763) 2020-06-25 17:04:57 -07:00
perf build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
reflection fix(compiler-cli): avoid creating value expressions for symbols from type-only imports (#37912) 2020-08-11 09:53:25 -07:00
resource refactor(compiler-cli): extract NgCompilerAdapter interface (#37118) 2020-06-03 13:29:44 -07:00
routing build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
scope refactor(compiler-cli): only use type constructors for directives with generic types (#38249) 2020-08-11 09:55:48 -07:00
shims fix(compiler-cli): mark eager NgModuleFactory construction as not side effectful (#38320) 2020-08-06 09:02:16 -07:00
sourcemaps fix(compiler-cli): only read source-map comment from last line (#32912) 2020-06-25 14:10:03 -07:00
switch build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
testing perf(compiler-cli): fix regressions in incremental program reuse (#37641) 2020-06-25 14:12:20 -07:00
transform refactor(compiler): wrap large strings in function (#38253) 2020-07-29 13:31:03 -07:00
translator refactor(compiler): add source-map spans to localized strings (#32912) 2020-06-25 14:10:03 -07:00
typecheck refactor(compiler-cli): only use type constructors for directives with generic types (#38249) 2020-08-11 09:55:48 -07:00
util fix(compiler-cli): ensure file_system handles mixed Windows drives (#37959) 2020-07-13 12:05:21 -07:00
program.ts refactor(compiler-cli): introduce the TemplateTypeChecker abstraction (#38105) 2020-07-29 10:31:20 -07:00
tsc_plugin.ts fix(compiler-cli): match wrapHost parameter types within plugin interface (#38004) 2020-08-05 10:54:07 -07:00