use of org.eclipse.n4js.ts.types.TEnumLiteral in project n4js by eclipse.
the class VisibilityAwareMemberScope method isAccepted.
@Override
protected boolean isAccepted(IEObjectDescription description) {
EObject proxyOrInstance = description.getEObjectOrProxy();
if (proxyOrInstance != null && !proxyOrInstance.eIsProxy()) {
if (proxyOrInstance instanceof TMember) {
TMember member = (TMember) proxyOrInstance;
MemberVisibility result = checker.isVisible(context, receiverType, member);
if (!result.visibility)
this.accessModifierSuggestionStore.put(description.getEObjectURI().toString(), result.accessModifierSuggestion);
return result.visibility;
} else if (proxyOrInstance instanceof TEnumLiteral) {
return checker.isEnumLiteralVisible(context, receiverType);
}
}
return true;
}
use of org.eclipse.n4js.ts.types.TEnumLiteral in project n4js by eclipse.
the class N4EnumLiteralImpl method setDefinedLiteral.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setDefinedLiteral(TEnumLiteral newDefinedLiteral) {
TEnumLiteral oldDefinedLiteral = definedLiteral;
definedLiteral = newDefinedLiteral;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, N4JSPackage.N4_ENUM_LITERAL__DEFINED_LITERAL, oldDefinedLiteral, definedLiteral));
}
use of org.eclipse.n4js.ts.types.TEnumLiteral in project n4js by eclipse.
the class N4JSResourceDescription method getImportedNames.
@Override
public Iterable<QualifiedName> getImportedNames() {
if (null == lazyImportedNames) {
synchronized (this) {
if (null == lazyImportedNames) {
// get imported names collected during global scoping
// the scope provider registers every request in scoping so that by this
// also all names are collected that cannot be resolved
Iterable<QualifiedName> superImportedNames = super.getImportedNames();
// use sorted set to ensure order of items
final SortedSet<QualifiedName> importedNames;
if (superImportedNames != null) {
importedNames = Sets.newTreeSet(superImportedNames);
} else {
importedNames = Sets.<QualifiedName>newTreeSet();
}
// import our own module name to get a proper change notification
Resource resource = getResource();
List<EObject> contents = resource.getContents();
if (contents.size() > 1) {
TModule module = (TModule) contents.get(1);
importedNames.add(qualifiedNameProvider.getFullyQualifiedName(module));
}
final Set<EObject> crossRefTypes = Sets.newHashSet();
IAcceptor<EObject> acceptor = getCrossRefTypeAcceptor(crossRefTypes);
crossReferenceComputer.computeCrossRefs(resource, acceptor);
for (EObject type : crossRefTypes) {
if (type instanceof Type) {
handleType(importedNames, type);
} else if (type instanceof TVariable) {
handleTVariable(importedNames, (TVariable) type);
} else if (type instanceof TEnumLiteral) {
handleTEnumLiteral(importedNames, (TEnumLiteral) type);
}
}
this.lazyImportedNames = importedNames;
}
}
}
return lazyImportedNames;
}
use of org.eclipse.n4js.ts.types.TEnumLiteral in project n4js by eclipse.
the class N4JSResourceDescription method getCrossRefTypeAcceptor.
private IAcceptor<EObject> getCrossRefTypeAcceptor(final Set<EObject> crossRefTypesAddHere) {
IAcceptor<EObject> acceptor = new IAcceptor<EObject>() {
@Override
public void accept(EObject to) {
if (to instanceof Type || to instanceof TVariable || to instanceof TEnumLiteral) {
crossRefTypesAddHere.add(to);
}
// Add declared type of a field to cross ref types
if (to instanceof TFunction) {
TypeRef returnTypeRef = ((TFunction) to).getReturnTypeRef();
crossRefTypesAddHere.add(returnTypeRef.getDeclaredType());
}
if (to instanceof TField) {
TypeRef typeRef = ((TField) to).getTypeRef();
crossRefTypesAddHere.add(typeRef.getDeclaredType());
}
// In case of TMember, add the containing type as well
if (to instanceof TMember) {
TMember casted = (TMember) to;
ContainerType<?> declaringType = casted.getContainingType();
crossRefTypesAddHere.add(declaringType);
}
}
};
return acceptor;
}
Aggregations