Rework class objects
Class objects have name "Default" by default
Do not produce synthetic class objects
Class objects have new semantics:
class "A" has class object "B" if literal "A" can be used as a value of type "B"
Class objects act like ordinary nested objects
i.e. are accessible from class scope via getClassifier()
Jvm backend: class object fields and class have the name of class object ("Default")
as opposed to special "OBJECT$" and "object"
Serialization: only the name of class object is needed to serialize data
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -20,7 +20,6 @@ import com.google.common.base.Predicate;
|
||||
import com.google.common.base.Predicates;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.builtins.KotlinBuiltIns;
|
||||
@@ -116,7 +115,7 @@ public class RecursiveDescriptorComparator {
|
||||
if (descriptor instanceof ClassDescriptor) {
|
||||
ClassDescriptor klass = (ClassDescriptor) descriptor;
|
||||
appendSubDescriptors(descriptor, module,
|
||||
klass.getDefaultType().getMemberScope(), getConstructorsAndClassObject(klass), printer);
|
||||
klass.getDefaultType().getMemberScope(), klass.getConstructors(), printer);
|
||||
JetScope staticScope = klass.getStaticScope();
|
||||
if (!staticScope.getAllDescriptors().isEmpty()) {
|
||||
printer.println();
|
||||
@@ -164,14 +163,6 @@ public class RecursiveDescriptorComparator {
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static List<DeclarationDescriptor> getConstructorsAndClassObject(@NotNull ClassDescriptor klass) {
|
||||
List<DeclarationDescriptor> constructorsAndClassObject = Lists.newArrayList();
|
||||
constructorsAndClassObject.addAll(klass.getConstructors());
|
||||
ContainerUtil.addIfNotNull(constructorsAndClassObject, klass.getClassObjectDescriptor());
|
||||
return constructorsAndClassObject;
|
||||
}
|
||||
|
||||
private boolean shouldSkip(@NotNull DeclarationDescriptor subDescriptor) {
|
||||
boolean isFunctionFromAny = subDescriptor.getContainingDeclaration() instanceof ClassDescriptor
|
||||
&& subDescriptor instanceof FunctionDescriptor
|
||||
@@ -183,7 +174,7 @@ public class RecursiveDescriptorComparator {
|
||||
@NotNull DeclarationDescriptor descriptor,
|
||||
@NotNull ModuleDescriptor module,
|
||||
@NotNull JetScope memberScope,
|
||||
@NotNull Collection<DeclarationDescriptor> extraSubDescriptors,
|
||||
@NotNull Collection<? extends DeclarationDescriptor> extraSubDescriptors,
|
||||
@NotNull Printer printer
|
||||
) {
|
||||
if (!module.equals(DescriptorUtils.getContainingModule(descriptor))) {
|
||||
|
||||
@@ -105,7 +105,6 @@ public class RecursiveDescriptorProcessor {
|
||||
&& visitChildren(descriptor.getThisAsReceiverParameter(), data)
|
||||
&& visitChildren(descriptor.getConstructors(), data)
|
||||
&& visitChildren(descriptor.getTypeConstructor().getParameters(), data)
|
||||
&& visitChildren(descriptor.getClassObjectDescriptor(), data)
|
||||
&& visitChildren(descriptor.getDefaultType().getMemberScope().getAllDescriptors(), data);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user