Qualified "this" supported by lazy resolve:

- Appropriate scope methods implemented
- Class declarations recorded in the binding trace
This commit is contained in:
Andrey Breslav
2012-07-23 13:43:35 +04:00
parent 1500b1783d
commit ea7e7f01fb
3 changed files with 36 additions and 1 deletions
@@ -187,7 +187,8 @@ public abstract class AbstractLazyMemberScope<D extends DeclarationDescriptor, D
@NotNull
@Override
public Collection<DeclarationDescriptor> getDeclarationsByLabel(@NotNull LabelName labelName) {
throw new UnsupportedOperationException(); // TODO
// A member scope has no labels
return Collections.emptySet();
}
@Override
@@ -26,6 +26,7 @@ import org.jetbrains.jet.lang.descriptors.*;
import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor;
import org.jetbrains.jet.lang.psi.*;
import org.jetbrains.jet.lang.resolve.AnnotationResolver;
import org.jetbrains.jet.lang.resolve.BindingContext;
import org.jetbrains.jet.lang.resolve.DescriptorResolver;
import org.jetbrains.jet.lang.resolve.DescriptorUtils;
import org.jetbrains.jet.lang.resolve.lazy.data.FilteringClassLikeInfo;
@@ -85,6 +86,8 @@ public class LazyClassDescriptor extends ClassDescriptorBase implements ClassDes
@NotNull JetClassLikeInfo classLikeInfo
) {
this.resolveSession = resolveSession;
this.resolveSession.getTrace().record(BindingContext.CLASS, classLikeInfo.getCorrespondingClassOrObject(), this);
this.originalClassInfo = classLikeInfo;
JetClassLikeInfo classLikeInfoForMembers =
classLikeInfo.getClassKind() != ClassKind.ENUM_CLASS ? classLikeInfo : noEnumEntries(classLikeInfo);
@@ -138,6 +141,7 @@ public class LazyClassDescriptor extends ClassDescriptorBase implements ClassDes
if (scopeForMemberDeclarationResolution == null) {
WritableScopeImpl scope = new WritableScopeImpl(
getScopeForMemberLookup(), this, RedeclarationHandler.DO_NOTHING, "Member Declaration Resolution");
scope.addLabeledDeclaration(this);
scope.importScope(getScopeForClassHeaderResolution());
scope.changeLockLevel(WritableScope.LockLevel.READING);
@@ -0,0 +1,30 @@
namespace <root>
// <namespace name="closures">
namespace closures
internal final class closures.A : jet.Any {
public final /*constructor*/ fun <init>(/*0*/ a: jet.Int): closures.A
internal final val a: jet.Int
internal final class closures.A.B : jet.Any {
public final /*constructor*/ fun <init>(): closures.A.B
internal final fun jet.Char.xx(): jet.Any
internal final val jet.Int.xx: jet.Int
internal final val x: closures.A.B
internal final val y: closures.A
internal final val z: closures.A.B
}
}
// </namespace name="closures">
internal final class A : jet.Any {
public final /*constructor*/ fun <init>(): A
internal final fun foo(): jet.Tuple0
internal final val x: jet.Tuple0
internal final val y: jet.Tuple0
internal final val z: jet.Tuple0
}
internal final class Dup : jet.Any {
public final /*constructor*/ fun <init>(): Dup
internal final fun Dup(): jet.Tuple0
}
internal final fun foo1(): jet.Tuple0