fix(ivy): don't accidently read the inherited definition (#25736)
Create getter methods `getXXXDef` for each definition which uses `hasOwnProperty` to verify that we don't accidently read form the parent class. Fixes: #24011 Fixes: #25026 PR Close #25736
This commit is contained in:
@ -39,11 +39,13 @@ export function InheritDefinitionFeature(
|
||||
while (superType) {
|
||||
let superDef: DirectiveDefInternal<any>|ComponentDefInternal<any>|undefined = undefined;
|
||||
if (isComponentDef(definition)) {
|
||||
// Don't use getComponentDef/getDirectiveDef. This logic relies on inheritance.
|
||||
superDef = superType.ngComponentDef || superType.ngDirectiveDef;
|
||||
} else {
|
||||
if (superType.ngComponentDef) {
|
||||
throw new Error('Directives cannot inherit Components');
|
||||
}
|
||||
// Don't use getComponentDef/getDirectiveDef. This logic relies on inheritance.
|
||||
superDef = superType.ngDirectiveDef;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user