Skip to content
Permalink
Browse files

fix(ivy): avoid using __proto__ when reading metadata in JIT mode (#3…

…4305)

In JIT mode we use `__proto__` when reading constructor parameter metadata, however it's not supported on IE10. These changes switch to using `Object.getPrototypeOf` instead.

PR Close #34305
  • Loading branch information
crisbeto authored and kara committed Dec 11, 2019
1 parent 3c3c07e commit 08ce0262c318761962b958c080afe4248306ea04
Showing with 8 additions and 4 deletions.
  1. +8 −4 packages/core/src/di/jit/util.ts
@@ -48,13 +48,17 @@ function reflectDependency(compiler: CompilerFacade, dep: any | any[]): R3Depend
if (param === undefined) {
// param may be undefined if type of dep is not set by ngtsc
continue;
} else if (param instanceof Optional || param.__proto__.ngMetadataName === 'Optional') {
}

const proto = Object.getPrototypeOf(param);

if (param instanceof Optional || proto.ngMetadataName === 'Optional') {
meta.optional = true;
} else if (param instanceof SkipSelf || param.__proto__.ngMetadataName === 'SkipSelf') {
} else if (param instanceof SkipSelf || proto.ngMetadataName === 'SkipSelf') {
meta.skipSelf = true;
} else if (param instanceof Self || param.__proto__.ngMetadataName === 'Self') {
} else if (param instanceof Self || proto.ngMetadataName === 'Self') {
meta.self = true;
} else if (param instanceof Host || param.__proto__.ngMetadataName === 'Host') {
} else if (param instanceof Host || proto.ngMetadataName === 'Host') {
meta.host = true;
} else if (param instanceof Inject) {
meta.token = param.token;

0 comments on commit 08ce026

Please sign in to comment.
You can’t perform that action at this time.