New J2K: Add temporary sorting of class declarations
This commit is contained in:
committed by
Ilya Kirillov
parent
03df0f1164
commit
61d6709cb7
@@ -54,6 +54,7 @@ object ConversionsRunner {
|
|||||||
+InstanceOfConversion()
|
+InstanceOfConversion()
|
||||||
+ForConversion(context)
|
+ForConversion(context)
|
||||||
+LabeledStatementConversion()
|
+LabeledStatementConversion()
|
||||||
|
+SortClassMembersConversion()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun doApply(trees: List<JKTreeElement>, context: ConversionContext) {
|
fun doApply(trees: List<JKTreeElement>, context: ConversionContext) {
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||||
|
* that can be found in the license/LICENSE.txt file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.jetbrains.kotlin.j2k.conversions
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.j2k.ast.EnumConstant
|
||||||
|
import org.jetbrains.kotlin.j2k.tree.*
|
||||||
|
|
||||||
|
//TODO temporary
|
||||||
|
class SortClassMembersConversion : RecursiveApplicableConversionBase() {
|
||||||
|
override fun applyToElement(element: JKTreeElement): JKTreeElement {
|
||||||
|
if (element !is JKClass) return recurse(element)
|
||||||
|
element.declarationList = element.declarationList
|
||||||
|
.sortedByDescending { it is JKField }
|
||||||
|
return recurse(element)
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user