diff --git a/src/org/jetbrains/jet/j2k/ast/ReturnStatement.java b/src/org/jetbrains/jet/j2k/ast/ReturnStatement.java deleted file mode 100644 index 1a266668bd2..00000000000 --- a/src/org/jetbrains/jet/j2k/ast/ReturnStatement.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2010-2012 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; - -import org.jetbrains.annotations.NotNull; -import org.jetbrains.jet.j2k.util.AstUtil; - -/** - * @author ignatov - */ -public class ReturnStatement extends Statement { - private final Expression myExpression; - private String myConversion = EMPTY; - - public ReturnStatement(Expression expression) { - myExpression = expression; - } - - public ReturnStatement(final Expression expression, final String conversion) { - this(expression); - myConversion = conversion; - } - - @NotNull - @Override - public String toKotlin() { - return "return" + SPACE + AstUtil.applyConversionForOneItem(myExpression.toKotlin(), myConversion); - } -} diff --git a/src/org/jetbrains/jet/j2k/ast/ReturnStatement.kt b/src/org/jetbrains/jet/j2k/ast/ReturnStatement.kt new file mode 100644 index 00000000000..2403273b126 --- /dev/null +++ b/src/org/jetbrains/jet/j2k/ast/ReturnStatement.kt @@ -0,0 +1,5 @@ +package org.jetbrains.jet.j2k.ast + +public open class ReturnStatement(val expression: Expression): Statement() { + public override fun toKotlin() = "return " + expression.toKotlin() +} diff --git a/src/org/jetbrains/jet/j2k/util/AstUtil.java b/src/org/jetbrains/jet/j2k/util/AstUtil.java index 7585d2dca5b..3171a651301 100644 --- a/src/org/jetbrains/jet/j2k/util/AstUtil.java +++ b/src/org/jetbrains/jet/j2k/util/AstUtil.java @@ -72,24 +72,6 @@ public class AstUtil { return string.substring(0, 1).toLowerCase() + string.substring(1); } - @NotNull - public static List createListWithEmptyString(@NotNull final List arguments) { - final List conversions = new LinkedList(); - //noinspection UnusedDeclaration - for (T argument : arguments) conversions.add(""); - return conversions; - } - - @NotNull - public static String applyConversionForOneItem(@NotNull String f, @NotNull String s) { - if (s.isEmpty()) { - return f; - } - else { - return "(" + f + ")" + s; - } - } - @NotNull public static T getOrElse(@NotNull Map map, @NotNull T e, @NotNull T orElse) { if (map.containsKey(e)) { @@ -97,12 +79,4 @@ public class AstUtil { } return orElse; } - - @NotNull - public static String replaceLastQuest(@NotNull String str) { - if (str.endsWith("?")) { - return str.substring(0, str.length() - 1); - } - return str; - } }