use of org.eclipse.n4js.scoping.accessModifiers.InvisibleTypeOrVariableDescription in project n4js by eclipse.
the class TopLevelElementsCollector method getTopLevelElements.
/**
* Returns an iterable of all top-level elements of the given module, given that they are accessed from the given
* context resource.
*
* @param module
* The module
* @param contextResource
* The context resource
*/
public Iterable<IEObjectDescription> getTopLevelElements(TModule module, Resource contextResource) {
List<IEObjectDescription> visible = new ArrayList<>();
List<IEObjectDescription> invisible = new ArrayList<>();
module.getTopLevelTypes().forEach(it -> {
TypeVisibility typeVisiblity = typeVisibilityChecker.isVisible(contextResource, it);
if (typeVisiblity.visibility) {
visible.add(createObjectDescription(it));
} else {
invisible.add(new InvisibleTypeOrVariableDescription(createObjectDescription(it), typeVisiblity.accessModifierSuggestion));
}
});
module.getVariables().forEach(it -> {
TypeVisibility typeVisiblity = variableVisibilityChecker.isVisible(contextResource, it);
if (typeVisiblity.visibility) {
visible.add(createObjectDescription(it));
} else {
invisible.add(new InvisibleTypeOrVariableDescription(createObjectDescription(it), typeVisiblity.accessModifierSuggestion));
}
});
return Iterables.concat(visible, invisible);
}
Aggregations