Class object always have name of the form <class-object-for-ClassName>.
This commit is contained in:
@@ -22,7 +22,6 @@ import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.asm4.Opcodes;
|
||||
import org.jetbrains.jet.lang.descriptors.*;
|
||||
import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor;
|
||||
import org.jetbrains.jet.lang.psi.JetPsiUtil;
|
||||
import org.jetbrains.jet.lang.resolve.DescriptorUtils;
|
||||
import org.jetbrains.jet.lang.resolve.java.JvmPrimitiveType;
|
||||
import org.jetbrains.jet.lang.resolve.name.FqNameUnsafe;
|
||||
@@ -36,6 +35,8 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.jetbrains.jet.lang.resolve.DescriptorUtils.getClassObjectName;
|
||||
|
||||
/**
|
||||
* @author yole
|
||||
* @author alex.tkachman
|
||||
@@ -145,7 +146,8 @@ public class IntrinsicMethods {
|
||||
|
||||
for (PrimitiveType type : PrimitiveType.NUMBER_TYPES) {
|
||||
intrinsicsMap.registerIntrinsic(
|
||||
JetStandardClasses.STANDARD_CLASSES_FQNAME.child(type.getRangeTypeName()).toUnsafe().child(JetPsiUtil.NO_NAME_PROVIDED),
|
||||
JetStandardClasses.STANDARD_CLASSES_FQNAME.child(type.getRangeTypeName()).toUnsafe().child(
|
||||
getClassObjectName(type.getRangeTypeName())),
|
||||
Name.identifier("EMPTY"), -1, new EmptyRange(type));
|
||||
}
|
||||
|
||||
|
||||
+3
-2
@@ -28,7 +28,6 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.lang.descriptors.*;
|
||||
import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor;
|
||||
import org.jetbrains.jet.lang.psi.JetPsiUtil;
|
||||
import org.jetbrains.jet.lang.resolve.*;
|
||||
import org.jetbrains.jet.lang.resolve.constants.*;
|
||||
import org.jetbrains.jet.lang.resolve.constants.StringValue;
|
||||
@@ -48,6 +47,8 @@ import org.jetbrains.jet.utils.ExceptionUtils;
|
||||
import javax.inject.Inject;
|
||||
import java.util.*;
|
||||
|
||||
import static org.jetbrains.jet.lang.resolve.DescriptorUtils.getClassObjectName;
|
||||
|
||||
/**
|
||||
* @author abreslav
|
||||
*/
|
||||
@@ -534,7 +535,7 @@ public class JavaDescriptorResolver implements DependencyClassByQualifiedNameRes
|
||||
classDescriptorCache.put(fqName, classData);
|
||||
|
||||
classData.classDescriptor.setSupertypes(getSupertypes(new PsiClassWrapper(classObjectPsiClass), classData, new ArrayList<TypeParameterDescriptor>(0)));
|
||||
classData.classDescriptor.setName(JetPsiUtil.NO_NAME_PROVIDED); // TODO
|
||||
classData.classDescriptor.setName(getClassObjectName(containing.getName()));
|
||||
classData.classDescriptor.setModality(Modality.FINAL);
|
||||
classData.classDescriptor.setVisibility(containing.getVisibility());
|
||||
classData.classDescriptor.setTypeParameterDescriptors(new ArrayList<TypeParameterDescriptor>(0));
|
||||
|
||||
@@ -25,6 +25,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.lang.descriptors.*;
|
||||
import org.jetbrains.jet.lang.psi.*;
|
||||
import org.jetbrains.jet.lang.resolve.name.Name;
|
||||
import org.jetbrains.jet.lang.resolve.scopes.JetScope;
|
||||
import org.jetbrains.jet.lang.resolve.scopes.RedeclarationHandler;
|
||||
import org.jetbrains.jet.lang.resolve.scopes.WritableScope;
|
||||
@@ -230,7 +231,8 @@ public class TypeHierarchyResolver {
|
||||
|
||||
@Override
|
||||
public void visitObjectDeclaration(JetObjectDeclaration declaration) {
|
||||
final MutableClassDescriptor objectDescriptor = createClassDescriptorForObject(declaration, owner, outerScope);
|
||||
final MutableClassDescriptor objectDescriptor =
|
||||
createClassDescriptorForObject(declaration, owner, outerScope, JetPsiUtil.safeName(declaration.getName()));
|
||||
owner.addObjectDescriptor(objectDescriptor);
|
||||
trace.record(FQNAME_TO_CLASS_DESCRIPTOR, JetPsiUtil.getFQName(declaration), objectDescriptor);
|
||||
}
|
||||
@@ -270,8 +272,9 @@ public class TypeHierarchyResolver {
|
||||
public void visitClassObject(JetClassObject classObject) {
|
||||
JetObjectDeclaration objectDeclaration = classObject.getObjectDeclaration();
|
||||
if (objectDeclaration != null) {
|
||||
Name classObjectName = getClassObjectName(owner.getOwnerForChildren().getName());
|
||||
MutableClassDescriptor classObjectDescriptor =
|
||||
createClassDescriptorForObject(objectDeclaration, owner, getStaticScope(classObject, owner));
|
||||
createClassDescriptorForObject(objectDeclaration, owner, getStaticScope(classObject, owner), classObjectName);
|
||||
NamespaceLikeBuilder.ClassObjectStatus status = owner.setClassObjectDescriptor(classObjectDescriptor);
|
||||
switch (status) {
|
||||
case DUPLICATE:
|
||||
@@ -306,10 +309,11 @@ public class TypeHierarchyResolver {
|
||||
}
|
||||
|
||||
private MutableClassDescriptor createClassDescriptorForObject(
|
||||
@NotNull JetObjectDeclaration declaration, @NotNull NamespaceLikeBuilder owner, JetScope scope
|
||||
@NotNull JetObjectDeclaration declaration, @NotNull NamespaceLikeBuilder owner,
|
||||
@NotNull JetScope scope, @NotNull Name name
|
||||
) {
|
||||
MutableClassDescriptor mutableClassDescriptor = new MutableClassDescriptor(
|
||||
owner.getOwnerForChildren(), scope, ClassKind.OBJECT, JetPsiUtil.safeName(declaration.getName()));
|
||||
owner.getOwnerForChildren(), scope, ClassKind.OBJECT, name);
|
||||
context.getObjects().put(declaration, mutableClassDescriptor);
|
||||
|
||||
JetScope classScope = mutableClassDescriptor.getScopeForMemberResolution();
|
||||
|
||||
@@ -223,10 +223,7 @@ public class LazyClassDescriptor extends ClassDescriptorBase implements ClassDes
|
||||
|
||||
JetClassLikeInfo classObjectInfo = getClassObjectInfo(classObject);
|
||||
if (classObjectInfo != null) {
|
||||
Name classObjectName = getKind() == ClassKind.ENUM_CLASS
|
||||
? getClassObjectName(getName())
|
||||
: JetPsiUtil.NO_NAME_PROVIDED;
|
||||
classObjectDescriptor = new LazyClassDescriptor(resolveSession, this, classObjectName, classObjectInfo);
|
||||
classObjectDescriptor = new LazyClassDescriptor(resolveSession, this, getClassObjectName(getName()), classObjectInfo);
|
||||
}
|
||||
classObjectDescriptorResolved = true;
|
||||
}
|
||||
|
||||
@@ -129,8 +129,8 @@ public final class jet.ByteRange : jet.Range<jet.Byte>, jet.ByteIterable {
|
||||
public final val size: jet.Int
|
||||
public final val start: jet.Byte
|
||||
public final fun step(/*0*/ step: jet.Int): jet.ByteIterator
|
||||
public final class object jet.ByteRange.<no name provided> : jet.Any {
|
||||
internal final /*constructor*/ fun <init>(): jet.ByteRange.<no name provided>
|
||||
public final class object jet.ByteRange.<class-object-for-ByteRange> : jet.Any {
|
||||
internal final /*constructor*/ fun <init>(): jet.ByteRange.<class-object-for-ByteRange>
|
||||
public final val EMPTY: jet.ByteRange
|
||||
}
|
||||
}
|
||||
@@ -222,8 +222,8 @@ public final class jet.CharRange : jet.Range<jet.Char>, jet.CharIterable {
|
||||
public final val size: jet.Int
|
||||
public final val start: jet.Char
|
||||
public final fun step(/*0*/ step: jet.Int): jet.CharIterator
|
||||
public final class object jet.CharRange.<no name provided> : jet.Any {
|
||||
internal final /*constructor*/ fun <init>(): jet.CharRange.<no name provided>
|
||||
public final class object jet.CharRange.<class-object-for-CharRange> : jet.Any {
|
||||
internal final /*constructor*/ fun <init>(): jet.CharRange.<class-object-for-CharRange>
|
||||
public final val EMPTY: jet.CharRange
|
||||
}
|
||||
}
|
||||
@@ -324,8 +324,8 @@ public final class jet.DoubleRange : jet.Range<jet.Double> {
|
||||
public final val size: jet.Double
|
||||
public final val start: jet.Double
|
||||
public final fun step(/*0*/ step: jet.Double): jet.DoubleIterator
|
||||
public final class object jet.DoubleRange.<no name provided> : jet.Any {
|
||||
internal final /*constructor*/ fun <init>(): jet.DoubleRange.<no name provided>
|
||||
public final class object jet.DoubleRange.<class-object-for-DoubleRange> : jet.Any {
|
||||
internal final /*constructor*/ fun <init>(): jet.DoubleRange.<class-object-for-DoubleRange>
|
||||
public final val EMPTY: jet.DoubleRange
|
||||
}
|
||||
}
|
||||
@@ -516,8 +516,8 @@ public final class jet.FloatRange : jet.Range<jet.Float> {
|
||||
public final val size: jet.Float
|
||||
public final val start: jet.Float
|
||||
public final fun step(/*0*/ step: jet.Float): jet.FloatIterator
|
||||
public final class object jet.FloatRange.<no name provided> : jet.Any {
|
||||
internal final /*constructor*/ fun <init>(): jet.FloatRange.<no name provided>
|
||||
public final class object jet.FloatRange.<class-object-for-FloatRange> : jet.Any {
|
||||
internal final /*constructor*/ fun <init>(): jet.FloatRange.<class-object-for-FloatRange>
|
||||
public final val EMPTY: jet.FloatRange
|
||||
}
|
||||
}
|
||||
@@ -716,8 +716,8 @@ public final class jet.IntRange : jet.Range<jet.Int>, jet.IntIterable {
|
||||
public final val size: jet.Int
|
||||
public final val start: jet.Int
|
||||
public final fun step(/*0*/ step: jet.Int): jet.IntIterator
|
||||
public final class object jet.IntRange.<no name provided> : jet.Any {
|
||||
internal final /*constructor*/ fun <init>(): jet.IntRange.<no name provided>
|
||||
public final class object jet.IntRange.<class-object-for-IntRange> : jet.Any {
|
||||
internal final /*constructor*/ fun <init>(): jet.IntRange.<class-object-for-IntRange>
|
||||
public final val EMPTY: jet.IntRange
|
||||
}
|
||||
}
|
||||
@@ -827,8 +827,8 @@ public final class jet.LongRange : jet.Range<jet.Long>, jet.LongIterable {
|
||||
public final val size: jet.Long
|
||||
public final val start: jet.Long
|
||||
public final fun step(/*0*/ step: jet.Long): jet.LongIterator
|
||||
public final class object jet.LongRange.<no name provided> : jet.Any {
|
||||
internal final /*constructor*/ fun <init>(): jet.LongRange.<no name provided>
|
||||
public final class object jet.LongRange.<class-object-for-LongRange> : jet.Any {
|
||||
internal final /*constructor*/ fun <init>(): jet.LongRange.<class-object-for-LongRange>
|
||||
public final val EMPTY: jet.LongRange
|
||||
}
|
||||
}
|
||||
@@ -942,8 +942,8 @@ public final class jet.ShortRange : jet.Range<jet.Short>, jet.ShortIterable {
|
||||
public final val size: jet.Int
|
||||
public final val start: jet.Short
|
||||
public final fun step(/*0*/ step: jet.Int): jet.ShortIterator
|
||||
public final class object jet.ShortRange.<no name provided> : jet.Any {
|
||||
internal final /*constructor*/ fun <init>(): jet.ShortRange.<no name provided>
|
||||
public final class object jet.ShortRange.<class-object-for-ShortRange> : jet.Any {
|
||||
internal final /*constructor*/ fun <init>(): jet.ShortRange.<class-object-for-ShortRange>
|
||||
public final val EMPTY: jet.ShortRange
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@ namespace test
|
||||
|
||||
internal final class test.ClassObjectDeclaresProperty : jet.Any {
|
||||
public final /*constructor*/ fun <init>(): test.ClassObjectDeclaresProperty
|
||||
internal final class object test.ClassObjectDeclaresProperty.<no name provided> : jet.Any {
|
||||
internal final /*constructor*/ fun <init>(): test.ClassObjectDeclaresProperty.<no name provided>
|
||||
internal final class object test.ClassObjectDeclaresProperty.<class-object-for-ClassObjectDeclaresProperty> : jet.Any {
|
||||
internal final /*constructor*/ fun <init>(): test.ClassObjectDeclaresProperty.<class-object-for-ClassObjectDeclaresProperty>
|
||||
internal final val i: jet.Int
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@ namespace test
|
||||
|
||||
internal final class test.ClassObjectDeclaresProperty : jet.Any {
|
||||
public final /*constructor*/ fun <init>(): test.ClassObjectDeclaresProperty
|
||||
internal final class object test.ClassObjectDeclaresProperty.<no name provided> : jet.Any {
|
||||
internal final /*constructor*/ fun <init>(): test.ClassObjectDeclaresProperty.<no name provided>
|
||||
internal final class object test.ClassObjectDeclaresProperty.<class-object-for-ClassObjectDeclaresProperty> : jet.Any {
|
||||
internal final /*constructor*/ fun <init>(): test.ClassObjectDeclaresProperty.<class-object-for-ClassObjectDeclaresProperty>
|
||||
internal final var s: jet.String
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ internal abstract trait test.Bbb : jet.Any {
|
||||
}
|
||||
internal final class test.ClassObjectextendsTrait : jet.Any {
|
||||
public final /*constructor*/ fun <init>(): test.ClassObjectextendsTrait
|
||||
internal final class object test.ClassObjectextendsTrait.<no name provided> : test.Bbb {
|
||||
internal final /*constructor*/ fun <init>(): test.ClassObjectextendsTrait.<no name provided>
|
||||
internal final class object test.ClassObjectextendsTrait.<class-object-for-ClassObjectextendsTrait> : test.Bbb {
|
||||
internal final /*constructor*/ fun <init>(): test.ClassObjectextendsTrait.<class-object-for-ClassObjectextendsTrait>
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -4,7 +4,7 @@ internal abstract trait test.Bbb</*0*/ P : jet.Any?> : jet.Any {
|
||||
}
|
||||
internal final class test.ClassObjectExtendsTraitWithTP : jet.Any {
|
||||
public final /*constructor*/ fun <init>(): test.ClassObjectExtendsTraitWithTP
|
||||
internal final class object test.ClassObjectExtendsTraitWithTP.<no name provided> : test.Bbb<jet.String> {
|
||||
internal final /*constructor*/ fun <init>(): test.ClassObjectExtendsTraitWithTP.<no name provided>
|
||||
internal final class object test.ClassObjectExtendsTraitWithTP.<class-object-for-ClassObjectExtendsTraitWithTP> : test.Bbb<jet.String> {
|
||||
internal final /*constructor*/ fun <init>(): test.ClassObjectExtendsTraitWithTP.<class-object-for-ClassObjectExtendsTraitWithTP>
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ namespace test
|
||||
|
||||
internal final class test.SimpleClassObject : jet.Any {
|
||||
public final /*constructor*/ fun <init>(): test.SimpleClassObject
|
||||
internal final class object test.SimpleClassObject.<no name provided> : jet.Any {
|
||||
internal final /*constructor*/ fun <init>(): test.SimpleClassObject.<no name provided>
|
||||
internal final class object test.SimpleClassObject.<class-object-for-SimpleClassObject> : jet.Any {
|
||||
internal final /*constructor*/ fun <init>(): test.SimpleClassObject.<class-object-for-SimpleClassObject>
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,4 +38,4 @@ trait TheTrait {
|
||||
//internal trait TheTrait defined in rendererTest
|
||||
//internal abstract fun abstractFun() : Unit defined in rendererTest.TheTrait
|
||||
//object : rendererTest.TheClass<jet.Int, jet.Int> defined in rendererTest.TheTrait
|
||||
//internal final fun classObjectFunction() : jet.Int defined in rendererTest.TheTrait.<no name provided>
|
||||
//internal final fun classObjectFunction() : jet.Int defined in rendererTest.TheTrait.<class-object-for-TheTrait>
|
||||
Reference in New Issue
Block a user