Supported loading named objects within named objects from compiled library.

This commit is contained in:
Evgeny Gerashchenko
2012-10-24 18:42:24 +04:00
parent 3ca976ee77
commit a71fa35187
5 changed files with 42 additions and 12 deletions
@@ -16,6 +16,7 @@
package org.jetbrains.jet.lang.resolve;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -27,6 +28,7 @@ import org.jetbrains.jet.lang.resolve.constants.CompileTimeConstant;
import org.jetbrains.jet.lang.resolve.name.FqName;
import org.jetbrains.jet.lang.resolve.name.FqNameUnsafe;
import org.jetbrains.jet.lang.resolve.name.Name;
import org.jetbrains.jet.lang.resolve.scopes.JetScope;
import org.jetbrains.jet.lang.resolve.scopes.receivers.ReceiverDescriptor;
import org.jetbrains.jet.lang.types.DescriptorSubstitutor;
import org.jetbrains.jet.lang.types.JetType;
@@ -366,11 +368,15 @@ public class DescriptorUtils {
@SuppressWarnings("unchecked")
public static Collection<ClassDescriptor> getInnerClasses(ClassDescriptor classDescriptor) {
Collection<DeclarationDescriptor> innerClasses = classDescriptor.getUnsubstitutedInnerClassesScope().getAllDescriptors();
for (DeclarationDescriptor inner : innerClasses) {
JetScope innerClassesScope = classDescriptor.getUnsubstitutedInnerClassesScope();
Collection<DeclarationDescriptor> inners = innerClassesScope.getAllDescriptors();
for (DeclarationDescriptor inner : inners) {
assert inner instanceof ClassDescriptor
: "Not a class in inner classes scope of " + classDescriptor + ": " + inner;
}
return (Collection) innerClasses;
return new ImmutableList.Builder<ClassDescriptor>()
.addAll((Collection) inners)
.addAll(innerClassesScope.getObjectDescriptors())
.build();
}
}