angular-docs-cn/packages/compiler-cli/test
Chuck Jazdzewski c685cc2f0a feat(compiler-cli): lower metadata `useValue` and `data` literal fields (#18905)
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
2017-08-30 18:00:38 -07:00
..
diagnostics feat(compiler-cli): lower metadata `useValue` and `data` literal fields (#18905) 2017-08-30 18:00:38 -07:00
transformers feat(compiler-cli): lower metadata `useValue` and `data` literal fields (#18905) 2017-08-30 18:00:38 -07:00
aot_host_spec.ts revert: feat(compiler-cli): support metadata file aliases (#15331) 2017-03-21 12:20:14 -05:00
main_spec.ts refactor(compiler-cli): cleanup API for transformer based ngc 2017-08-11 13:20:45 -07:00
mocks.ts fix: turn on nullability in the code base. 2017-04-18 12:07:33 -07:00
ngc_spec.ts feat(compiler-cli): lower metadata `useValue` and `data` literal fields (#18905) 2017-08-30 18:00:38 -07:00