use of org.eclipse.n4js.ts.types.FieldAccessor in project n4js by eclipse.
the class N4JSMemberRedefinitionValidator method checkUnpairedAccessorFilling.
private void checkUnpairedAccessorFilling(MemberMatrix mm, N4ClassifierDefinition definition) {
if (definition.getDefinedType().isStaticPolyfill() && mm.hasMixedAccessorPair()) {
FieldAccessor ownedAccessor = (FieldAccessor) Iterables.getFirst(mm.owned(), null);
if (null == ownedAccessor) {
// Should not happen, a mixed accessor pair implies at least one owned member
return;
}
if (!(definition instanceof N4ClassDefinition)) {
// Non-class static polyfills aren't allowed. Validated somewhere else.
return;
}
TClass filledClass = MemberRedefinitionUtils.getFilledClass((N4ClassDefinition) definition);
if (null == filledClass) {
// Invalid static polyfill class. Validated somewhere else.
return;
}
// Iterate over all inherited members
SourceAwareIterator memberIterator = mm.actuallyInheritedAndMixedMembers();
while (memberIterator.hasNext()) {
TMember next = memberIterator.next();
ContainerType<?> containingType = next.getContainingType();
// Issue an error if the member isn't owned by the filled class
if (containingType != filledClass) {
messageMissingOwnedAccessor(ownedAccessor);
}
}
}
}
Aggregations