JS Changes according to review
This commit is contained in:
committed by
Sergey Mashkov
parent
e3ae12ed62
commit
7033b27ea8
@@ -15,7 +15,7 @@ import org.w3c.dom.svg.*
|
||||
import org.w3c.fetch.*
|
||||
import org.w3c.files.*
|
||||
import org.w3c.notifications.*
|
||||
import org.w3c.time.*
|
||||
import org.w3c.performance.*
|
||||
import org.w3c.workers.*
|
||||
import org.w3c.xhr.*
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ import org.w3c.dom.svg.*
|
||||
import org.w3c.fetch.*
|
||||
import org.w3c.files.*
|
||||
import org.w3c.notifications.*
|
||||
import org.w3c.time.*
|
||||
import org.w3c.performance.*
|
||||
import org.w3c.workers.*
|
||||
import org.w3c.xhr.*
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ import org.w3c.dom.svg.*
|
||||
import org.w3c.fetch.*
|
||||
import org.w3c.files.*
|
||||
import org.w3c.notifications.*
|
||||
import org.w3c.time.*
|
||||
import org.w3c.performance.*
|
||||
import org.w3c.workers.*
|
||||
import org.w3c.xhr.*
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ import org.w3c.dom.svg.*
|
||||
import org.w3c.fetch.*
|
||||
import org.w3c.files.*
|
||||
import org.w3c.notifications.*
|
||||
import org.w3c.time.*
|
||||
import org.w3c.performance.*
|
||||
import org.w3c.workers.*
|
||||
import org.w3c.xhr.*
|
||||
|
||||
@@ -3026,6 +3026,9 @@ native public trait Window : EventTarget {
|
||||
var caches: CacheStorage
|
||||
get() = noImpl
|
||||
set(value) = noImpl
|
||||
var performance: Performance
|
||||
get() = noImpl
|
||||
set(value) = noImpl
|
||||
var window: Window
|
||||
get() = noImpl
|
||||
set(value) = noImpl
|
||||
|
||||
@@ -15,7 +15,7 @@ import org.w3c.dom.svg.*
|
||||
import org.w3c.fetch.*
|
||||
import org.w3c.files.*
|
||||
import org.w3c.notifications.*
|
||||
import org.w3c.time.*
|
||||
import org.w3c.performance.*
|
||||
import org.w3c.workers.*
|
||||
import org.w3c.xhr.*
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ import org.w3c.dom.parsing.*
|
||||
import org.w3c.fetch.*
|
||||
import org.w3c.files.*
|
||||
import org.w3c.notifications.*
|
||||
import org.w3c.time.*
|
||||
import org.w3c.performance.*
|
||||
import org.w3c.workers.*
|
||||
import org.w3c.xhr.*
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ import org.w3c.dom.parsing.*
|
||||
import org.w3c.dom.svg.*
|
||||
import org.w3c.files.*
|
||||
import org.w3c.notifications.*
|
||||
import org.w3c.time.*
|
||||
import org.w3c.performance.*
|
||||
import org.w3c.workers.*
|
||||
import org.w3c.xhr.*
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ import org.w3c.dom.parsing.*
|
||||
import org.w3c.dom.svg.*
|
||||
import org.w3c.fetch.*
|
||||
import org.w3c.notifications.*
|
||||
import org.w3c.time.*
|
||||
import org.w3c.performance.*
|
||||
import org.w3c.workers.*
|
||||
import org.w3c.xhr.*
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ import org.w3c.dom.parsing.*
|
||||
import org.w3c.dom.svg.*
|
||||
import org.w3c.fetch.*
|
||||
import org.w3c.files.*
|
||||
import org.w3c.time.*
|
||||
import org.w3c.performance.*
|
||||
import org.w3c.workers.*
|
||||
import org.w3c.xhr.*
|
||||
|
||||
|
||||
@@ -0,0 +1,113 @@
|
||||
/*
|
||||
* Generated file
|
||||
* DO NOT EDIT
|
||||
*
|
||||
* See libraries/tools/idl2k for details
|
||||
*/
|
||||
|
||||
package org.w3c.performance
|
||||
|
||||
import org.khronos.webgl.*
|
||||
import org.w3c.dom.*
|
||||
import org.w3c.dom.css.*
|
||||
import org.w3c.dom.events.*
|
||||
import org.w3c.dom.parsing.*
|
||||
import org.w3c.dom.svg.*
|
||||
import org.w3c.fetch.*
|
||||
import org.w3c.files.*
|
||||
import org.w3c.notifications.*
|
||||
import org.w3c.workers.*
|
||||
import org.w3c.xhr.*
|
||||
|
||||
native public trait Performance {
|
||||
var timing: PerformanceTiming
|
||||
get() = noImpl
|
||||
set(value) = noImpl
|
||||
var navigation: PerformanceNavigation
|
||||
get() = noImpl
|
||||
set(value) = noImpl
|
||||
fun now(): Double = noImpl
|
||||
}
|
||||
|
||||
native public trait PerformanceTiming {
|
||||
var navigationStart: Long
|
||||
get() = noImpl
|
||||
set(value) = noImpl
|
||||
var unloadEventStart: Long
|
||||
get() = noImpl
|
||||
set(value) = noImpl
|
||||
var unloadEventEnd: Long
|
||||
get() = noImpl
|
||||
set(value) = noImpl
|
||||
var redirectStart: Long
|
||||
get() = noImpl
|
||||
set(value) = noImpl
|
||||
var redirectEnd: Long
|
||||
get() = noImpl
|
||||
set(value) = noImpl
|
||||
var fetchStart: Long
|
||||
get() = noImpl
|
||||
set(value) = noImpl
|
||||
var domainLookupStart: Long
|
||||
get() = noImpl
|
||||
set(value) = noImpl
|
||||
var domainLookupEnd: Long
|
||||
get() = noImpl
|
||||
set(value) = noImpl
|
||||
var connectStart: Long
|
||||
get() = noImpl
|
||||
set(value) = noImpl
|
||||
var connectEnd: Long
|
||||
get() = noImpl
|
||||
set(value) = noImpl
|
||||
var secureConnectionStart: Long
|
||||
get() = noImpl
|
||||
set(value) = noImpl
|
||||
var requestStart: Long
|
||||
get() = noImpl
|
||||
set(value) = noImpl
|
||||
var responseStart: Long
|
||||
get() = noImpl
|
||||
set(value) = noImpl
|
||||
var responseEnd: Long
|
||||
get() = noImpl
|
||||
set(value) = noImpl
|
||||
var domLoading: Long
|
||||
get() = noImpl
|
||||
set(value) = noImpl
|
||||
var domInteractive: Long
|
||||
get() = noImpl
|
||||
set(value) = noImpl
|
||||
var domContentLoadedEventStart: Long
|
||||
get() = noImpl
|
||||
set(value) = noImpl
|
||||
var domContentLoadedEventEnd: Long
|
||||
get() = noImpl
|
||||
set(value) = noImpl
|
||||
var domComplete: Long
|
||||
get() = noImpl
|
||||
set(value) = noImpl
|
||||
var loadEventStart: Long
|
||||
get() = noImpl
|
||||
set(value) = noImpl
|
||||
var loadEventEnd: Long
|
||||
get() = noImpl
|
||||
set(value) = noImpl
|
||||
}
|
||||
|
||||
native public trait PerformanceNavigation {
|
||||
var type: Short
|
||||
get() = noImpl
|
||||
set(value) = noImpl
|
||||
var redirectCount: Short
|
||||
get() = noImpl
|
||||
set(value) = noImpl
|
||||
|
||||
companion object {
|
||||
val TYPE_NAVIGATE: Short = 0
|
||||
val TYPE_RELOAD: Short = 1
|
||||
val TYPE_BACK_FORWARD: Short = 2
|
||||
val TYPE_RESERVED: Short = 255
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
/*
|
||||
* Generated file
|
||||
* DO NOT EDIT
|
||||
*
|
||||
* See libraries/tools/idl2k for details
|
||||
*/
|
||||
|
||||
package org.w3c.time
|
||||
|
||||
import org.khronos.webgl.*
|
||||
import org.w3c.dom.*
|
||||
import org.w3c.dom.css.*
|
||||
import org.w3c.dom.events.*
|
||||
import org.w3c.dom.parsing.*
|
||||
import org.w3c.dom.svg.*
|
||||
import org.w3c.fetch.*
|
||||
import org.w3c.files.*
|
||||
import org.w3c.notifications.*
|
||||
import org.w3c.workers.*
|
||||
import org.w3c.xhr.*
|
||||
|
||||
native public trait Performance {
|
||||
fun now(): Double = noImpl
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ import org.w3c.dom.svg.*
|
||||
import org.w3c.fetch.*
|
||||
import org.w3c.files.*
|
||||
import org.w3c.notifications.*
|
||||
import org.w3c.time.*
|
||||
import org.w3c.performance.*
|
||||
import org.w3c.xhr.*
|
||||
|
||||
native public trait ServiceWorkerRegistration : EventTarget {
|
||||
|
||||
@@ -16,7 +16,7 @@ import org.w3c.dom.svg.*
|
||||
import org.w3c.fetch.*
|
||||
import org.w3c.files.*
|
||||
import org.w3c.notifications.*
|
||||
import org.w3c.time.*
|
||||
import org.w3c.performance.*
|
||||
import org.w3c.workers.*
|
||||
|
||||
native public trait XMLHttpRequestEventTarget : EventTarget {
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
namespace org.w3c.performance;
|
||||
|
||||
|
||||
typedef double DOMHighResTimeStamp;
|
||||
partial interface Performance {
|
||||
DOMHighResTimeStamp now();
|
||||
};
|
||||
interface PerformanceTiming {
|
||||
readonly attribute unsigned long long navigationStart;
|
||||
readonly attribute unsigned long long unloadEventStart;
|
||||
readonly attribute unsigned long long unloadEventEnd;
|
||||
readonly attribute unsigned long long redirectStart;
|
||||
readonly attribute unsigned long long redirectEnd;
|
||||
readonly attribute unsigned long long fetchStart;
|
||||
readonly attribute unsigned long long domainLookupStart;
|
||||
readonly attribute unsigned long long domainLookupEnd;
|
||||
readonly attribute unsigned long long connectStart;
|
||||
readonly attribute unsigned long long connectEnd;
|
||||
readonly attribute unsigned long long secureConnectionStart;
|
||||
readonly attribute unsigned long long requestStart;
|
||||
readonly attribute unsigned long long responseStart;
|
||||
readonly attribute unsigned long long responseEnd;
|
||||
readonly attribute unsigned long long domLoading;
|
||||
readonly attribute unsigned long long domInteractive;
|
||||
readonly attribute unsigned long long domContentLoadedEventStart;
|
||||
readonly attribute unsigned long long domContentLoadedEventEnd;
|
||||
readonly attribute unsigned long long domComplete;
|
||||
readonly attribute unsigned long long loadEventStart;
|
||||
readonly attribute unsigned long long loadEventEnd;
|
||||
};
|
||||
interface PerformanceNavigation {
|
||||
const unsigned short TYPE_NAVIGATE = 0;
|
||||
const unsigned short TYPE_RELOAD = 1;
|
||||
const unsigned short TYPE_BACK_FORWARD = 2;
|
||||
const unsigned short TYPE_RESERVED = 255;
|
||||
readonly attribute unsigned short type;
|
||||
readonly attribute unsigned short redirectCount;
|
||||
};
|
||||
interface Performance {
|
||||
readonly attribute PerformanceTiming timing;
|
||||
readonly attribute PerformanceNavigation navigation;
|
||||
};
|
||||
|
||||
partial interface Window {
|
||||
[Replaceable] readonly attribute Performance performance;
|
||||
};
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
namespace org.w3c.time;
|
||||
|
||||
|
||||
typedef double DOMHighResTimeStamp;
|
||||
partial interface Performance {
|
||||
DOMHighResTimeStamp now();
|
||||
};
|
||||
|
||||
@@ -23,26 +23,31 @@ import java.io.File
|
||||
import java.net.URL
|
||||
|
||||
val urls = listOf(
|
||||
// "http://heycam.github.io/webidl/" to "org.w3c.webidl"
|
||||
"https://raw.githubusercontent.com/whatwg/html-mirror/master/source" to "org.w3c.dom",
|
||||
"https://html.spec.whatwg.org/" to "org.w3c.dom",
|
||||
"https://raw.githubusercontent.com/whatwg/dom/master/dom.html" to "org.w3c.dom",
|
||||
"http://www.w3.org/TR/uievents/" to "org.w3c.dom.events",
|
||||
"https://dvcs.w3.org/hg/editing/raw-file/tip/editing.html" to "org.w3c.dom",
|
||||
"http://www.w3.org/TR/animation-timing/" to "org.w3c.dom",
|
||||
"http://www.w3.org/TR/hr-time/" to "org.w3c.time",
|
||||
"https://raw.githubusercontent.com/whatwg/xhr/master/Overview.src.html" to "org.w3c.xhr",
|
||||
"https://raw.githubusercontent.com/w3c/FileAPI/gh-pages/index.html" to "org.w3c.files",
|
||||
"https://raw.githubusercontent.com/whatwg/notifications/master/notifications.html" to "org.w3c.notifications",
|
||||
"https://raw.githubusercontent.com/whatwg/fullscreen/master/Overview.src.html" to "org.w3c.fullscreen",
|
||||
"http://www.w3.org/TR/DOM-Parsing/" to "org.w3c.dom.parsing",
|
||||
"http://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html" to "org.w3c.workers",
|
||||
"https://raw.githubusercontent.com/whatwg/fetch/master/Overview.src.html" to "org.w3c.fetch",
|
||||
"http://www.w3.org/TR/vibration/" to "org.w3c.vibration",
|
||||
"http://www.w3.org/TR/uievents/" to "org.w3c.dom.events",
|
||||
"http://dev.w3.org/csswg/cssom/" to "org.w3c.dom.css",
|
||||
"http://www.w3.org/TR/DOM-Parsing/" to "org.w3c.dom.parsing",
|
||||
|
||||
"http://web.archive.org/web/20150317051602/http://www.w3.org/TR/SVG11/single-page.html" to "org.w3c.dom.svg",
|
||||
"https://www.khronos.org/registry/webgl/specs/latest/1.0/webgl.idl" to "org.khronos.webgl",
|
||||
"https://www.khronos.org/registry/typedarray/specs/latest/typedarray.idl" to "org.khronos.webgl"
|
||||
"https://www.khronos.org/registry/typedarray/specs/latest/typedarray.idl" to "org.khronos.webgl",
|
||||
|
||||
"https://raw.githubusercontent.com/whatwg/xhr/master/Overview.src.html" to "org.w3c.xhr",
|
||||
"https://raw.githubusercontent.com/whatwg/fetch/master/Overview.src.html" to "org.w3c.fetch",
|
||||
"https://raw.githubusercontent.com/w3c/FileAPI/gh-pages/index.html" to "org.w3c.files",
|
||||
|
||||
"https://raw.githubusercontent.com/whatwg/notifications/master/notifications.html" to "org.w3c.notifications",
|
||||
"https://raw.githubusercontent.com/whatwg/fullscreen/master/Overview.src.html" to "org.w3c.fullscreen",
|
||||
"http://www.w3.org/TR/vibration/" to "org.w3c.vibration",
|
||||
|
||||
"http://www.w3.org/TR/hr-time/" to "org.w3c.performance",
|
||||
"http://www.w3.org/TR/2012/REC-navigation-timing-20121217/" to "org.w3c.performance",
|
||||
|
||||
"http://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html" to "org.w3c.workers"
|
||||
)
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
@@ -61,7 +66,7 @@ fun main(args: Array<String>) {
|
||||
w.appendln()
|
||||
|
||||
e.value.forEach { pair ->
|
||||
val (url, _) = pair
|
||||
val (url) = pair
|
||||
println("Loading ${url}...")
|
||||
|
||||
if (url.endsWith(".idl")) {
|
||||
|
||||
@@ -174,7 +174,7 @@ fun generateUnions(ifaces: List<GenerateTraitOrClass>, typedefs: Iterable<Typede
|
||||
typedefsToBeGenerated.flatMap { typedef -> typedef.value.memberTypes.map { unionMember -> unionMember to typedef.name } }.toMultiMap()
|
||||
|
||||
return GenerateUnionTypes(
|
||||
typeNamesToUnions = typeNamesToUnions,
|
||||
typeNamesToUnionsMap = typeNamesToUnions,
|
||||
anonymousUnionsMap = anonymousUnionsMap,
|
||||
typedefsMarkersMap = typedefsMarkersMap
|
||||
)
|
||||
|
||||
@@ -259,7 +259,7 @@ class ConstantVisitor : WebIDLBaseVisitor<Constant>() {
|
||||
}
|
||||
|
||||
class DefinitionVisitor(val extendedAttributes: List<ExtendedAttribute>, val namespace: String, val declarations: MutableList<Definition>) : WebIDLBaseVisitor<Definition>() {
|
||||
private var kind: DefinitionKind = DefinitionKind.INTERFACE
|
||||
private var kind = DefinitionKind.INTERFACE
|
||||
private var name = ""
|
||||
private val memberAttributes = ArrayList<ExtendedAttribute>()
|
||||
private val operations = ArrayList<Operation>()
|
||||
|
||||
@@ -101,7 +101,7 @@ fun InterfaceDefinition?.hasExtendedAttribute(name: String) = this?.findExtended
|
||||
fun InterfaceDefinition.findConstructor() = findExtendedAttribute("Constructor")
|
||||
|
||||
data class GenerateUnionTypes(
|
||||
val typeNamesToUnions : Map<String, List<String>>,
|
||||
val anonymousUnionsMap : Map<String, GenerateTraitOrClass>,
|
||||
val typedefsMarkersMap : Map<String, GenerateTraitOrClass>
|
||||
val typeNamesToUnionsMap: Map<String, List<String>>,
|
||||
val anonymousUnionsMap: Map<String, GenerateTraitOrClass>,
|
||||
val typedefsMarkersMap: Map<String, GenerateTraitOrClass>
|
||||
)
|
||||
|
||||
@@ -42,7 +42,7 @@ private fun String.parse() = if (this.startsWith("0x")) BigInteger(this.substrin
|
||||
private fun String.replaceWrongConstants(type: String) = if (this == "noImpl" || type == "Int" && parse() > BigInteger.valueOf(Int.MAX_VALUE.toLong())) "noImpl" else this
|
||||
private fun String.replaceKeywords() = if (this in keywords) this + "_" else this
|
||||
|
||||
private fun Appendable.renderArgumentsDeclaration(allTypes: Set<String>, args: List<GenerateAttribute>, omitDefaults: Boolean) =
|
||||
private fun Appendable.renderArgumentsDeclaration(args: List<GenerateAttribute>, omitDefaults: Boolean) =
|
||||
args.map {
|
||||
StringBuilder {
|
||||
if (it.vararg) {
|
||||
@@ -60,7 +60,7 @@ private fun Appendable.renderArgumentsDeclaration(allTypes: Set<String>, args: L
|
||||
|
||||
private fun renderCall(call: GenerateFunctionCall) = "${call.name.replaceKeywords()}(${call.arguments.map { it.replaceKeywords() }.join(", ")})"
|
||||
|
||||
private fun Appendable.renderFunctionDeclaration(allTypes: Set<String>, f: GenerateFunction, override: Boolean) {
|
||||
private fun Appendable.renderFunctionDeclaration(f: GenerateFunction, override: Boolean) {
|
||||
indent(1)
|
||||
|
||||
when (f.nativeGetterOrSetter) {
|
||||
@@ -76,7 +76,7 @@ private fun Appendable.renderFunctionDeclaration(allTypes: Set<String>, f: Gener
|
||||
append("native(\"${f.name}\") ")
|
||||
}
|
||||
append("fun ${f.name.replaceKeywords()}(")
|
||||
renderArgumentsDeclaration(allTypes, f.arguments, override)
|
||||
renderArgumentsDeclaration(f.arguments, override)
|
||||
appendln("): ${f.returnType} = noImpl")
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ fun Appendable.render(allTypes: Map<String, GenerateTraitOrClass>, typeNamesToUn
|
||||
append(iface.name)
|
||||
if (iface.constructor != null && iface.constructor.arguments.isNotEmpty()) {
|
||||
append("(")
|
||||
renderArgumentsDeclaration(allTypes.keySet(), iface.constructor.arguments.map { it.dynamicIfUnknownType(allTypes.keySet()) }, false)
|
||||
renderArgumentsDeclaration(iface.constructor.arguments.map { it.dynamicIfUnknownType(allTypes.keySet()) }, false)
|
||||
append(")")
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ fun Appendable.render(allTypes: Map<String, GenerateTraitOrClass>, typeNamesToUn
|
||||
renderAttributeDeclaration(arg, arg.signature in superSignatures)
|
||||
}
|
||||
iface.memberFunctions.filter { it !in superFunctions }.map { it.dynamicIfUnknownType(allTypes.keySet()) }.groupBy { it.signature }.reduceValues(::betterFunction).values().forEach {
|
||||
renderFunctionDeclaration(allTypes.keySet(), it, it.signature in superSignatures)
|
||||
renderFunctionDeclaration(it, it.signature in superSignatures)
|
||||
}
|
||||
if (iface.constants.isNotEmpty()) {
|
||||
appendln()
|
||||
@@ -155,7 +155,7 @@ fun Appendable.render(namespace: String, ifaces: List<GenerateTraitOrClass>, uni
|
||||
|
||||
val allTypes = declaredTypes + unions.anonymousUnionsMap + unions.typedefsMarkersMap
|
||||
declaredTypes.values().filter { it.namespace == namespace }.forEach {
|
||||
render(allTypes, unions.typeNamesToUnions, it)
|
||||
render(allTypes, unions.typeNamesToUnionsMap, it)
|
||||
}
|
||||
|
||||
unions.anonymousUnionsMap.values().filter { it.namespace == "" || it.namespace == namespace }.forEach {
|
||||
|
||||
@@ -56,13 +56,14 @@ fun allSuperTypesImpl(roots: List<GenerateTraitOrClass>, all: Map<String, Genera
|
||||
}
|
||||
|
||||
data class FunctionType(val parameterTypes : List<Attribute>, val returnType : String)
|
||||
|
||||
val FunctionType.arity : Int
|
||||
get() = parameterTypes.size()
|
||||
val FunctionType.text : String
|
||||
get() = "(${parameterTypes.map { it.formatFunctionTypePart() }.join(",")}) -> ${returnType}"
|
||||
|
||||
fun FunctionType(text : String) : FunctionType {
|
||||
val (parameters, returnType) = text.split("->".toRegex()).map {it.trim()}.filter { it != "" }
|
||||
val (parameters, returnType) = text.split("->".toRegex()).map { it.trim() }.filter { it != "" }
|
||||
|
||||
return FunctionType(
|
||||
parameterTypes = parameters.removeSurrounding("(", ")").split(',')
|
||||
@@ -80,14 +81,14 @@ fun String.dynamicIfUnknownType(allTypes: Set<String>, standardTypes: Set<String
|
||||
this in standardTypes -> this
|
||||
startsWith("Array<") -> "Array<" + removePrefix("Array<").removeSuffix(">").dynamicIfUnknownType(allTypes, standardTypes) + ">"
|
||||
startsWith("Union<") -> UnionType("", splitUnionType(this)).name.dynamicIfUnknownType(allTypes, standardTypes).copyNullabilityFrom(this)
|
||||
this != dropNullable() -> dropNullable().dynamicIfUnknownType(allTypes, standardTypes).ensureNullable()
|
||||
isNullable() -> dropNullable().dynamicIfUnknownType(allTypes, standardTypes).ensureNullable()
|
||||
contains("->") -> {
|
||||
FunctionType(this).let { function ->
|
||||
function.copy(
|
||||
returnType = function.returnType.dynamicIfUnknownType(allTypes, standardTypes),
|
||||
parameterTypes = function.parameterTypes.map { it.copy(type = it.type.dynamicIfUnknownType(allTypes, standardTypes)) }
|
||||
).text
|
||||
}
|
||||
val function = FunctionType(this)
|
||||
|
||||
function.copy(
|
||||
returnType = function.returnType.dynamicIfUnknownType(allTypes, standardTypes),
|
||||
parameterTypes = function.parameterTypes.map { it.copy(type = it.type.dynamicIfUnknownType(allTypes, standardTypes)) }
|
||||
).text
|
||||
}
|
||||
else -> "dynamic"
|
||||
}
|
||||
@@ -103,7 +104,10 @@ private fun mapType(repository: Repository, type: String): String =
|
||||
type.startsWith("sequence") -> "Array<dynamic>"
|
||||
type in repository.typeDefs -> mapTypedef(repository, type)
|
||||
type in repository.enums -> "String"
|
||||
type.contains("->") -> FunctionType(type).let { function ->
|
||||
type.contains("->") -> {
|
||||
val function = FunctionType(type)
|
||||
|
||||
// TODO: Remove takeWhile { !vararg } when we have varargs supported. See KT-3115
|
||||
function.copy(
|
||||
returnType = mapType(repository, function.returnType),
|
||||
parameterTypes = function.parameterTypes.takeWhile { !it.vararg }.map { it.copy(type = mapType(repository, it.type)) }
|
||||
|
||||
Reference in New Issue
Block a user