Smarter members sorting.
This commit is contained in:
@@ -32,21 +32,28 @@ public class MemberComparator implements Comparator<DeclarationDescriptor> {
|
||||
}
|
||||
|
||||
private static int getDeclarationPriority(DeclarationDescriptor descriptor) {
|
||||
if (descriptor instanceof ClassDescriptor) {
|
||||
return 4;
|
||||
if (descriptor instanceof ConstructorDescriptor) {
|
||||
return 6;
|
||||
}
|
||||
else if (descriptor instanceof PropertyDescriptor) {
|
||||
return 3;
|
||||
}
|
||||
else if (descriptor instanceof FunctionDescriptor) {
|
||||
FunctionDescriptor fun = (FunctionDescriptor)descriptor;
|
||||
if (fun.getReceiverParameter() == null) {
|
||||
return 2;
|
||||
if (((PropertyDescriptor)descriptor).getReceiverParameter() == null) {
|
||||
return 5;
|
||||
}
|
||||
else {
|
||||
return 1;
|
||||
return 4;
|
||||
}
|
||||
}
|
||||
else if (descriptor instanceof FunctionDescriptor) {
|
||||
if (((FunctionDescriptor)descriptor).getReceiverParameter() == null) {
|
||||
return 3;
|
||||
}
|
||||
else {
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
else if (descriptor instanceof ClassDescriptor) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -71,7 +78,8 @@ public class MemberComparator implements Comparator<DeclarationDescriptor> {
|
||||
|
||||
ReceiverParameterDescriptor c1ReceiverParameter = c1.getReceiverParameter();
|
||||
ReceiverParameterDescriptor c2ReceiverParameter = c2.getReceiverParameter();
|
||||
if (c1ReceiverParameter != null && c2ReceiverParameter != null) {
|
||||
assert (c1ReceiverParameter != null) == (c2ReceiverParameter != null);
|
||||
if (c1ReceiverParameter != null) {
|
||||
String r1 = DescriptorRenderer.TEXT.renderType(c1ReceiverParameter.getType());
|
||||
String r2 = DescriptorRenderer.TEXT.renderType(c2ReceiverParameter.getType());
|
||||
int receiversCompareTo = r1.compareTo(r2);
|
||||
|
||||
@@ -3,16 +3,16 @@
|
||||
|
||||
package testData.libraries
|
||||
|
||||
[public final val globalVal : testData.libraries.Pair<jet.Int, jet.String>] /* compiled code */
|
||||
|
||||
[public final val globalValWithGetter : jet.Long] /* compiled code */
|
||||
|
||||
[public final val jet.Int.exProp : jet.Int] /* compiled code */
|
||||
|
||||
[public final val jet.String.exProp : jet.String] /* compiled code */
|
||||
|
||||
[public final val <T> testData.libraries.Pair<T, T>.exProp : jet.String] /* compiled code */
|
||||
|
||||
[public final val globalVal : testData.libraries.Pair<jet.Int, jet.String>] /* compiled code */
|
||||
|
||||
[public final val globalValWithGetter : jet.Long] /* compiled code */
|
||||
|
||||
[public final fun func() : Unit { /* compiled code */ }]
|
||||
|
||||
[public final fun func(a : jet.Int, b : jet.Int) : Unit { /* compiled code */ }]
|
||||
|
||||
Reference in New Issue
Block a user