JS IDL2K spaces in functional types

This commit is contained in:
Sergey Mashkov
2015-05-13 19:03:40 +03:00
committed by Sergey Mashkov
parent b34da5713d
commit 002b26e4ed
4 changed files with 8 additions and 8 deletions
+1 -1
View File
@@ -67,7 +67,7 @@ fun generateFunctions(repository: Repository, function: Operation): List<Generat
it.copy(type = callbackFunction.parameters
.map { it.copy(type = mapType(repository, it.type)) }
.map { it.formatFunctionTypePart() }
.join(",", "(", ") -> ${mapType(repository, callbackFunction.returnType)}")
.join(", ", "(", ") -> ${mapType(repository, callbackFunction.returnType)}")
.copyNullabilityFrom(it.type))
}
else -> it
+1 -1
View File
@@ -290,7 +290,7 @@ class DefinitionVisitor(val extendedAttributes: List<ExtendedAttribute>, val nam
name = getName(ctx)
val function = OperationVisitor(memberAttributes.toList()).visit(ctx)
typedefType = "(${function.parameters.map { it.formatFunctionTypePart() }.join(",")}) -> ${function.returnType}"
typedefType = "(${function.parameters.map { it.formatFunctionTypePart() }.join(", ")}) -> ${function.returnType}"
memberAttributes.clear()
return defaultResult()
@@ -60,7 +60,7 @@ data class FunctionType(val parameterTypes : List<Attribute>, val returnType : S
val FunctionType.arity : Int
get() = parameterTypes.size()
val FunctionType.text : String
get() = "(${parameterTypes.map { it.formatFunctionTypePart() }.join(",")}) -> ${returnType}"
get() = "(${parameterTypes.map { it.formatFunctionTypePart() }.join(", ")}) -> ${returnType}"
fun FunctionType(text : String) : FunctionType {
val (parameters, returnType) = text.split("->".toRegex()).map { it.trim() }.filter { it != "" }