Java to Kotlin: dropped Node interface

This commit is contained in:
Valentin Kipyatkov
2014-06-16 20:26:51 +04:00
parent 0912001560
commit 7463da8fe0
3 changed files with 4 additions and 25 deletions
+3 -2
View File
@@ -16,9 +16,10 @@
package org.jetbrains.jet.j2k.ast
trait Element {
public fun toKotlin(): String
trait Element : Node {
val isEmpty: Boolean get() = false
public val isEmpty: Boolean get() = false
object Empty : Element {
override fun toKotlin() = ""
-22
View File
@@ -1,22 +0,0 @@
/*
* Copyright 2010-2013 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.jet.j2k.ast
trait Node {
public fun toKotlin(): String
}
+1 -1
View File
@@ -18,7 +18,7 @@ package org.jetbrains.jet.j2k.ast
import java.util.ArrayList
fun List<Node>.toKotlin(separator: String, prefix: String = "", postfix: String = ""): String
fun List<Element>.toKotlin(separator: String, prefix: String = "", postfix: String = ""): String
= if (isNotEmpty()) map { it.toKotlin() }.makeString(separator, prefix, postfix) else ""
fun String.withSuffix(suffix: String): String = if (isEmpty()) "" else this + suffix