From e84aa78ac64bcf25ebf255ae961a0545a6576262 Mon Sep 17 00:00:00 2001 From: Sergey Mashkov Date: Thu, 30 Apr 2015 15:34:27 +0300 Subject: [PATCH] JS introduce marker annotation --- js/js.libraries/src/core/annotations.kt | 3 +++ js/js.libraries/src/core/dom3.kt | 4 ++-- libraries/tools/idl2k/src/main/kotlin/gen2.kt | 7 +++++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/js/js.libraries/src/core/annotations.kt b/js/js.libraries/src/core/annotations.kt index f2d93397d0d..db66184b765 100644 --- a/js/js.libraries/src/core/annotations.kt +++ b/js/js.libraries/src/core/annotations.kt @@ -29,3 +29,6 @@ native public annotation class library(public val name: String = "") native public annotation class enumerable() + +native +public annotation class marker \ No newline at end of file diff --git a/js/js.libraries/src/core/dom3.kt b/js/js.libraries/src/core/dom3.kt index f36fe2b2332..f0f24f4e343 100644 --- a/js/js.libraries/src/core/dom3.kt +++ b/js/js.libraries/src/core/dom3.kt @@ -5505,7 +5505,7 @@ native trait PseudoElement { } native trait CSS { } -native trait UnionHTMLOptGroupElementOrHTMLOptionElement { +native marker trait UnionHTMLOptGroupElementOrHTMLOptionElement { } -native trait UnionElementOrMouseEvent { +native marker trait UnionElementOrMouseEvent { } diff --git a/libraries/tools/idl2k/src/main/kotlin/gen2.kt b/libraries/tools/idl2k/src/main/kotlin/gen2.kt index b39cf2bdabe..c733c336247 100644 --- a/libraries/tools/idl2k/src/main/kotlin/gen2.kt +++ b/libraries/tools/idl2k/src/main/kotlin/gen2.kt @@ -205,11 +205,14 @@ private fun O.renderFunction(allTypes: Set, f: Generate appendln(") : ${f.returnType.mapUnknownType(allTypes)} = noImpl") } -fun O.render(allTypes: Map, classesToUnions : Map>, iface: GenerateTraitOrClass) { +fun O.render(allTypes: Map, classesToUnions : Map>, iface: GenerateTraitOrClass, markerAnnotation : Boolean = false) { val superTypes = iface.allSuperTypes(allTypes).filter { it.name != "" } val superTypesNames = superTypes.map { it.name }.toSet() append("native ") + if (markerAnnotation) { + append("marker ") + } when (iface.type) { GenerateDefinitionType.CLASS -> append("open class ") GenerateDefinitionType.TRAIT -> append("trait ") @@ -267,6 +270,6 @@ fun O.render(ifaces: List) { } unionTypeTraits.forEach { - render(all, emptyMap(), it) + render(all, emptyMap(), it, markerAnnotation = true) } } \ No newline at end of file