fix(ivy): proper resolution of Enums in Component decorator (#27971)
Prior to this change Component decorator was resolving `encapsulation` value a bit incorrectly, which resulted in `encapsulation: NaN` in compiled code. Now we resolve the value as Enum memeber and throw if it's not the case. As a part of this update, the `changeDetection` field handling is also added, the resolution logic is the same as the one used for `encapsulation` field. PR Close #27971
This commit is contained in:
@ -257,7 +257,8 @@ export class StaticInterpreter {
|
||||
node.members.forEach(member => {
|
||||
const name = this.stringNameFromPropertyName(member.name, context);
|
||||
if (name !== undefined) {
|
||||
map.set(name, new EnumValue(enumRef, name));
|
||||
const resolved = member.initializer && this.visit(member.initializer, context);
|
||||
map.set(name, new EnumValue(enumRef, name, resolved));
|
||||
}
|
||||
});
|
||||
return map;
|
||||
|
@ -70,7 +70,9 @@ export interface ResolvedValueArray extends Array<ResolvedValue> {}
|
||||
* Contains a `Reference` to the enumeration itself, and the name of the referenced member.
|
||||
*/
|
||||
export class EnumValue {
|
||||
constructor(readonly enumRef: Reference<ts.EnumDeclaration>, readonly name: string) {}
|
||||
constructor(
|
||||
readonly enumRef: Reference<ts.EnumDeclaration>, readonly name: string,
|
||||
readonly resolved: ResolvedValue) {}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user