angular-docs-cn/packages/core/test/render3
crisbeto ab3f4c9fe1 fix(core): infinite loop if injectable using inheritance has a custom decorator (#37022)
If we detect that an injectable class is inheriting from another injectable, we generate code that looks something like this:

```
const baseFactory = ɵɵgetInheritedFactory(Child);

@Injectable()
class Parent {}

@Injectable()
class Child extends Parent {
  static ɵfac = (t) => baseFactory(t || Child)
}
```

This usually works fine, because the `ɵɵgetInheritedFactory` resolves to the factory of `Parent`, but the logic can break down if the `Child` class has a custom decorator. Custom decorators can return a new class that extends the original once, which means that the `ɵɵgetInheritedFactory` call will now resolve to the factory of the `Child`, causing an infinite loop.

These changes fix the issue by changing the inherited factory resolution logic so that it walks up the prototype chain class-by-class, while skipping classes that have the same factory as the class that was passed in.

Fixes #35733.

PR Close #37022
2020-06-03 13:16:25 -07:00
..
instructions build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
ivy build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
jit build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
perf build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
styling_next build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
util build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
BUILD.bazel build: derive ts_library dep from jasmine_node_test boostrap label if it ends in `_es5` (#34736) 2020-01-15 14:58:07 -05:00
change_detection_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
common_with_def.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
component_ref_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
component_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
di_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
domino.d.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
global_utils_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
i18n_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
imported_renderer2.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
instructions_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
integration_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
jit_environment_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
listeners_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
load_domino.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
metadata_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
node_selector_matcher_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
perfCounter_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
pipe_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
providers_spec.ts fix(core): infinite loop if injectable using inheritance has a custom decorator (#37022) 2020-06-03 13:16:25 -07:00
query_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
render_util.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
renderer_factory_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
testing_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
view_container_ref_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
view_utils_spec.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00