This commit is contained in:
Dmitry Jemerov
2012-05-30 18:55:46 +02:00
committed by Pavel V. Talanov
parent c7a4236d93
commit b6ca2ddf75
6 changed files with 6 additions and 17 deletions
+1 -1
View File
@@ -28,7 +28,7 @@ public open class Enum(converter : Converter,
primaryConstructorSignatureToKotlin() +
typeParametersToKotlin() +
implementTypesToKotlin() +
" {\n" + AstUtil.joinNodes(membersExceptConstructors(), "\n") + "\n" +
" {\n" + membersExceptConstructors().toKotlin("\n") + "\n" +
primaryConstructorBodyToKotlin() +
"\npublic fun name() : String { return \"\" }\npublic fun order() : Int { return 0 }\n}"
}
+1 -1
View File
@@ -9,7 +9,7 @@ public open class File(val packageName: String,
val mainFunction: String): Node() {
public override fun toKotlin(): String {
val common: String = AstUtil.joinNodes(imports, "\n") + "\n\n" + AstUtil.joinNodes(classes, "\n") + "\n" + mainFunction
val common: String = imports.toKotlin("\n") + "\n\n" + classes.toKotlin("\n") + "\n" + mainFunction
if (packageName.isEmpty()) {
return common
}
@@ -11,10 +11,7 @@ public open class MethodCallExpression(val methodCall: Expression,
public override fun isNullable(): Boolean = methodCall.isNullable() || resultIsNullable
public override fun toKotlin(): String {
val typeParamsToKotlin: String? = (if (typeParameters.size() > 0)
"<" + AstUtil.joinNodes(typeParameters, ", ") + ">"
else
"")
val typeParamsToKotlin: String = typeParameters.toKotlin(", ", "<", ">")
val argumentsMapped = arguments.map { it.toKotlin() }
return methodCall.toKotlin() + typeParamsToKotlin + "(" + argumentsMapped.makeString(", ") + ")"
}
@@ -38,7 +38,7 @@ public class NewClassExpression extends Expression {
myArguments = arguments;
}
public NewClassExpression(@NotNull Expression qualifier, @NotNull Element name, @NotNull List<Expression> arguments,
public NewClassExpression(@NotNull Element name, @NotNull List<Expression> arguments, @NotNull Expression qualifier,
@Nullable AnonymousClass anonymousClass) {
this(name, arguments);
myQualifier = qualifier;
@@ -5,11 +5,5 @@ import org.jetbrains.jet.j2k.util.AstUtil
import java.util.List
public open class ReferenceElement(val reference : Identifier, val types : List<Type>) : Element() {
public override fun toKotlin() : String {
val typesIfNeeded : String = (if (types.size() > 0)
"<" + AstUtil.joinNodes(types, ", ") + ">"
else
"")
return reference.toKotlin() + typesIfNeeded
}
public override fun toKotlin() = reference.toKotlin() + types.toKotlin(", ", "<", ">")
}
@@ -277,9 +277,7 @@ public class ExpressionVisitor extends StatementVisitor {
PsiExpression[] arguments = argumentList != null ? argumentList.getExpressions() : new PsiExpression[]{};
if (constructor == null || Converter.$classobj.isConstructorPrimary(constructor) || isNotConvertedClass) {
return new NewClassExpression(
getConverter().expressionToExpression(expression.getQualifier()),
getConverter().elementToElement(classReference),
getConverter().argumentsToExpressionList(expression),
getConverter().elementToElement(classReference), getConverter().argumentsToExpressionList(expression), getConverter().expressionToExpression(expression.getQualifier()),
anonymousClass != null ? getConverter().anonymousClassToAnonymousClass(anonymousClass) : null
);
}