use of org.eclipse.n4js.ts.types.ComposedMemberCache in project n4js by eclipse.
the class IndexedAccessExpressionImpl method setComposedMemberCache.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setComposedMemberCache(ComposedMemberCache newComposedMemberCache) {
ComposedMemberCache oldComposedMemberCache = composedMemberCache;
composedMemberCache = newComposedMemberCache;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, N4JSPackage.INDEXED_ACCESS_EXPRESSION__COMPOSED_MEMBER_CACHE, oldComposedMemberCache, composedMemberCache));
}
use of org.eclipse.n4js.ts.types.ComposedMemberCache in project n4js by eclipse.
the class ParameterizedPropertyAccessExpressionImpl method setComposedMemberCache.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setComposedMemberCache(ComposedMemberCache newComposedMemberCache) {
ComposedMemberCache oldComposedMemberCache = composedMemberCache;
composedMemberCache = newComposedMemberCache;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, N4JSPackage.PARAMETERIZED_PROPERTY_ACCESS_EXPRESSION__COMPOSED_MEMBER_CACHE, oldComposedMemberCache, composedMemberCache));
}
use of org.eclipse.n4js.ts.types.ComposedMemberCache in project n4js by eclipse.
the class MemberAccessImpl method setComposedMemberCache.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setComposedMemberCache(ComposedMemberCache newComposedMemberCache) {
ComposedMemberCache oldComposedMemberCache = composedMemberCache;
composedMemberCache = newComposedMemberCache;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, N4JSPackage.MEMBER_ACCESS__COMPOSED_MEMBER_CACHE, oldComposedMemberCache, composedMemberCache));
}
use of org.eclipse.n4js.ts.types.ComposedMemberCache in project n4js by eclipse.
the class JSXPropertyAttributeImpl method setComposedMemberCache.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setComposedMemberCache(ComposedMemberCache newComposedMemberCache) {
ComposedMemberCache oldComposedMemberCache = composedMemberCache;
composedMemberCache = newComposedMemberCache;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, N4JSPackage.JSX_PROPERTY_ATTRIBUTE__COMPOSED_MEMBER_CACHE, oldComposedMemberCache, composedMemberCache));
}
use of org.eclipse.n4js.ts.types.ComposedMemberCache in project n4js by eclipse.
the class ComposedMemberScope method createComposedMember.
/**
* Key method of entire scoping for composed types e.g. union/intersection types. This creates a new TMember as a
* combination of all members of the given name in the type's contained types. If those members cannot be combined
* into a single valid member, this method creates a dummy placeholder.
*/
private TMember createComposedMember(String memberName) {
// check all subScopes for a member of the given name and
// merge the properties of the existing members into 'composedMember'
final Resource resource = EcoreUtilN4.getResource(request.context, composedTypeRef);
ComposedMemberInfoBuilder cmiBuilder = new ComposedMemberInfoBuilder();
cmiBuilder.init(writeAccess, resource, ts);
for (int idx = 0; idx < subScopes.length; idx++) {
final IScope subScope = subScopes[idx];
final TypeRef typeRef = composedTypeRef.getTypeRefs().get(idx);
final Resource res = EcoreUtilN4.getResource(request.context, composedTypeRef);
final RuleEnvironment GwithSubstitutions = ts.createRuleEnvironmentForContext(typeRef, res);
final TMember member = findMemberInSubScope(subScope, memberName);
cmiBuilder.addMember(member, GwithSubstitutions);
}
// produce result
ComposedMemberInfo cmi = cmiBuilder.get();
ComposedMemberFactory cmf = getComposedMemberFactory(cmi);
if (!cmf.isEmpty()) {
// at least one of the subScopes had an element of that name
final TMember result;
if (cmf.isValid()) {
// success case: The element for that name can be merged into a valid composed member
result = cmf.create(memberName);
} else {
// some of the subScopes do not have an element for that name OR
// they do not form a valid composed member (e.g. they are of different kind)
// -> produce a specific error message explaining the incompatibility
// (this error placeholder will be wrapped with a UncommonMemberDescription
// in #getSingleLocalElementByName(QualifiedName) above)
result = createErrorPlaceholder(memberName);
}
// add composed member to ComposedTypeRef's cache (without notifications to avoid cache-clear)
final ComposedMemberCache cache = getOrCreateComposedMemberCache();
if (cache != null) {
EcoreUtilN4.doWithDeliver(false, () -> {
cache.getCachedComposedMembers().add(result);
}, cache);
}
// if cache==null: simply do not cache the composed member (i.e. member won't be contained in a resource!)
return result;
} else {
// -> produce the ordinary "Cannot resolve reference ..." error by returning 'null'
return null;
}
}
Aggregations