protected IFeatureScopeSession addThisAndSuper( IFeatureScopeSession session, ITypeReferenceOwner owner, JvmDeclaredType thisType, /* @Nullable */ JvmTypeReference superType, boolean addNestedTypes) { IFeatureScopeSession childSession = session; if (thisType.eContainer() != null) { if (thisType.isStatic()) { childSession = childSession.dropLocalElements(); } else { childSession = childSession.captureLocalElements(); } } if (superType != null && superType.getType() != null) { ImmutableMap.Builder<QualifiedName, JvmIdentifiableElement> builder = ImmutableMap.builder(); builder.put(IFeatureNames.THIS, thisType); builder.put(IFeatureNames.SUPER, superType.getType()); childSession = childSession.addLocalElements(builder.build(), owner); } else { childSession = childSession.addLocalElement(IFeatureNames.THIS, thisType, owner); } childSession = addThisTypeToStaticScope(childSession, thisType); if (addNestedTypes) childSession = childSession.addNestedTypesToScope(thisType); return childSession; }
JvmTypeReference superType = getExtendedClass(type); IFeatureScopeSession result = featureScopeSession; if (superType != null) {
protected void prepareMembers(ResolvedTypes resolvedTypes, IFeatureScopeSession featureScopeSession, JvmDeclaredType type, Map<JvmIdentifiableElement, ResolvedTypes> resolvedTypesByType) { IFeatureScopeSession childSession = addExtensionsToMemberSession(resolvedTypes, featureScopeSession, type); StackedResolvedTypes childResolvedTypes = declareTypeParameters(resolvedTypes, type, resolvedTypesByType); JvmTypeReference superType = getExtendedClass(type); ITypeReferenceOwner referenceOwner = childResolvedTypes.getReferenceOwner(); if (superType != null) { LightweightTypeReference lightweightSuperType = referenceOwner.toLightweightTypeReference(superType); childResolvedTypes.reassignTypeWithoutMerge(superType.getType(), lightweightSuperType); /* * We use reassignType to make sure that the following works: * * StringList extends AbstractList<String> { * NestedIntList extends AbstractList<Integer> { * } * SubType extends StringList {} * } */ } LightweightTypeReference lightweightThisType = referenceOwner.toLightweightTypeReference(type); childResolvedTypes.reassignTypeWithoutMerge(type, lightweightThisType); List<JvmMember> members = type.getMembers(); int size = members.size(); for(int i = 0; i < size; i++) { doPrepare(childResolvedTypes, childSession, members.get(i), resolvedTypesByType); } }