angular/packages
JoostK 373e1337de fix(ngcc): consistently use outer declaration for classes (#32539)
In ngcc's reflection hosts for compiled JS bundles, such as ESM2015,
special care needs to be taken for classes as there may be an outer
declaration (referred to as "declaration") and an inner declaration
(referred to as "implementation") for a given class. Therefore, there
will also be two `ts.Symbol`s bound per class, and ngcc needs to switch
between those declarations and symbols depending on where certain
information can be found.

Prior to this commit, the `NgccReflectionHost` interface had methods
`getClassSymbol` and `findClassSymbols` that would return a `ts.Symbol`.
These class symbols would be used to kick off compilation of components
using ngtsc, so it is important for these symbols to correspond with the
publicly visible outer declaration of the class. However, the ESM2015
reflection host used to return the `ts.Symbol` for the inner
declaration, if the class was declared as follows:

```javascript
var MyClass = class MyClass {};
```

For the above code, `Esm2015ReflectionHost.getClassSymbol` would return
the `ts.Symbol` corresponding with the `class MyClass {}` declaration,
whereas it should have corresponded with the `var MyClass` declaration.
As a consequence, no `NgModule` could be resolved for the component, so
no components/directives would be in scope for the component. This
resulted in errors during runtime.

This commit resolves the issue by introducing a `NgccClassSymbol` that
contains references to both the outer and inner `ts.Symbol`, instead of
just a single `ts.Symbol`. This avoids the unclarity of whether a
`ts.Symbol` corresponds with the outer or inner declaration.

More details can be found here: https://hackmd.io/7nkgWOFWQlSRAuIW_8KPPw

Fixes #32078
Closes FW-1507

PR Close #32539
2019-09-12 11:12:10 -07:00
..
animations refactor(core): Migrate TestBed.get to TestBed.inject (#32382) 2019-09-09 19:10:54 -04:00
bazel refactor(bazel): remove @angular/bazel protractor rule now provided by @bazel/protractor (#32485) 2019-09-10 15:19:31 -04:00
benchpress build: TypeScript 3.5 upgrade (#31615) 2019-07-25 17:05:23 -07:00
common revert: refactor(ivy): remove styling state storage and introduce direct style writing (#32259) 2019-09-11 15:24:10 -07:00
compiler revert: refactor(ivy): remove styling state storage and introduce direct style writing (#32259) 2019-09-11 15:24:10 -07:00
compiler-cli fix(ngcc): consistently use outer declaration for classes (#32539) 2019-09-12 11:12:10 -07:00
core perf(ivy): avoid repeat lview reads in pipe instructions (#32633) 2019-09-12 10:35:03 -07:00
docs
elements fix(elements): handle falsy initial value (#31604) 2019-07-18 14:26:37 -07:00
examples refactor(bazel): remove @angular/bazel protractor rule now provided by @bazel/protractor (#32485) 2019-09-10 15:19:31 -04:00
forms docs(forms): correct parameter names in jsdoc (#32530) 2019-09-09 15:55:42 -04:00
http refactor: Move dom_adapter.ts to @angular/common (#32154) 2019-08-29 21:51:56 -07:00
language-service fix(language-service): Lazily instantiate MetadataResolver (#32631) 2019-09-12 10:24:32 -07:00
localize feat(ivy): implement $localize() global function (#31609) 2019-08-30 12:53:25 -07:00
platform-browser fix(core): initialize global ngDevMode without toplevel side effects (#32079) 2019-09-11 20:31:14 -04:00
platform-browser-dynamic refactor(core): Migrate TestBed.get to TestBed.inject (#32382) 2019-09-09 19:10:54 -04:00
platform-server refactor(core): move Meta methods that only have one version from DomAdapter (#32408) 2019-09-03 11:59:39 -07:00
platform-webworker refactor(core): move Meta methods that only have one version from DomAdapter (#32408) 2019-09-03 11:59:39 -07:00
platform-webworker-dynamic build: convert entry_point to label (#30627) 2019-06-11 00:03:11 +00:00
private/testing test(ivy): add onlyInIvy perf counter expectations (#30339) 2019-05-09 11:22:00 -07:00
router docs: fix typos in the routing and testing documentation (#32329) 2019-09-10 07:58:44 -04:00
service-worker refactor(core): Migrate TestBed.get to TestBed.inject (#32382) 2019-09-09 19:10:54 -04:00
upgrade refactor(core): Migrate TestBed.get to TestBed.inject (#32382) 2019-09-09 19:10:54 -04:00
zone.js fix(zone.js): a path traversal attack in test (#32392) 2019-08-30 12:44:46 -07:00
BUILD.bazel refactor(core): ensure compatibility with typescript strict flag (#30993) 2019-07-18 14:21:25 -07:00
empty.ts
goog.d.ts fix(ivy): use goog.LOCALE for Closure Compiler to define default LOCALE_ID (#31519) 2019-07-16 13:02:10 -04:00
license-banner.txt build: bump year (#27880) 2019-01-11 11:15:59 -08:00
README.md Revert "docs: Remove unneeded file (#18106)" 2017-07-20 16:46:47 -05:00
system.d.ts
tsconfig-build-no-strict.json refactor(core): ensure compatibility with typescript strict flag (#30993) 2019-07-18 14:21:25 -07:00
tsconfig-build.json refactor(core): ensure compatibility with typescript strict flag (#30993) 2019-07-18 14:21:25 -07:00
tsconfig-test.json refactor: fix typescript strict flag failures in all tests (#30993) 2019-07-18 14:21:26 -07:00
tsconfig.json test(language-service): Make tests better by adding more assertions (#32630) 2019-09-12 10:23:51 -07:00
types.d.ts build: switch to typescript's es2015 typings (#28570) 2019-02-06 14:17:55 -05:00

Angular

The sources for this package are in the main Angular repo. Please file issues and pull requests against that repo.

License: MIT