mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
With this commit the compiler will "lower" expressions into exported
variables for values the compiler does not need to know statically
in order to be able to generate a factory. For example:
```
providers: [{provider: 'token', useValue: calculated()}]
```
produced an error as the expression `calculated()` is not supported
by the compiler because `calculated` is not a
[known function](https://angular.io/guide/metadata#annotationsdecorators)
With this commit this is rewritten, during emit of the .js file, into
something like:
```
export var ɵ0 = calculated();
...
provdiers: [{provider: 'token', useValue: ɵ0}]
```
The compiler then will now generate a reference to the exported `ɵ0`
instead of failing to evaluate `calculated()`.
PR Close #18905
|
||
|---|---|---|
| .. | ||
| diagnostics | ||
| transformers | ||
| codegen.ts | ||
| compiler_host.ts | ||
| extract_i18n.ts | ||
| extractor.ts | ||
| language_services.ts | ||
| main.ts | ||
| ngtools_api.ts | ||
| ngtools_impl.ts | ||
| path_mapped_compiler_host.ts | ||
| perform-compile.ts | ||
| version.ts | ||