fix(ivy): avoid using __proto__ when reading metadata in JIT mode (#34305)
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
This commit is contained in:
parent
758f7a7d8e
commit
1efa0ca4d0
|
@ -48,13 +48,17 @@ function reflectDependency(compiler: CompilerFacade, dep: any | any[]): R3Depend
|
||||||
if (param === undefined) {
|
if (param === undefined) {
|
||||||
// param may be undefined if type of dep is not set by ngtsc
|
// param may be undefined if type of dep is not set by ngtsc
|
||||||
continue;
|
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;
|
meta.optional = true;
|
||||||
} else if (param instanceof SkipSelf || param.__proto__.ngMetadataName === 'SkipSelf') {
|
} else if (param instanceof SkipSelf || proto.ngMetadataName === 'SkipSelf') {
|
||||||
meta.skipSelf = true;
|
meta.skipSelf = true;
|
||||||
} else if (param instanceof Self || param.__proto__.ngMetadataName === 'Self') {
|
} else if (param instanceof Self || proto.ngMetadataName === 'Self') {
|
||||||
meta.self = true;
|
meta.self = true;
|
||||||
} else if (param instanceof Host || param.__proto__.ngMetadataName === 'Host') {
|
} else if (param instanceof Host || proto.ngMetadataName === 'Host') {
|
||||||
meta.host = true;
|
meta.host = true;
|
||||||
} else if (param instanceof Inject) {
|
} else if (param instanceof Inject) {
|
||||||
meta.token = param.token;
|
meta.token = param.token;
|
||||||
|
|
Loading…
Reference in New Issue