From 3c60e73d196bc4df04fcaca935166c187f58a863 Mon Sep 17 00:00:00 2001 From: Sergey Mashkov Date: Thu, 13 Oct 2016 21:52:48 +0300 Subject: [PATCH] IDL2K: map array literal --- libraries/tools/idl2k/src/main/kotlin/gen.kt | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/libraries/tools/idl2k/src/main/kotlin/gen.kt b/libraries/tools/idl2k/src/main/kotlin/gen.kt index c2d48ff5be1..7516f779421 100644 --- a/libraries/tools/idl2k/src/main/kotlin/gen.kt +++ b/libraries/tools/idl2k/src/main/kotlin/gen.kt @@ -14,10 +14,12 @@ fun generateFunction(repository: Repository, function: Operation, functionName: name = functionName, returnType = mapType(repository, function.returnType).let { mapped -> if (nativeGetterOrSetter == NativeGetterOrSetter.GETTER) mapped.toNullableIfNonPrimitive() else mapped }, arguments = function.parameters.map { + val mappedType = mapType(repository, it.type) + GenerateAttribute( name = it.name, - type = mapType(repository, it.type), - initializer = it.defaultValue, + type = mappedType, + initializer = mapLiteral(it.defaultValue, mappedType), getterSetterNoImpl = false, override = false, kind = AttributeKind.ARGUMENT, @@ -67,7 +69,7 @@ fun generateFunctions(repository: Repository, function: Operation): List, typedefs: Iterable when { + expectedType == DynamicType -> "arrayOf()" + expectedType is AnyType -> "arrayOf()" + expectedType is UnionType -> "arrayOf()" + else -> "arrayOf()" + } + else -> literal +} \ No newline at end of file