JS introduce marker annotation

This commit is contained in:
Sergey Mashkov
2015-04-30 15:34:27 +03:00
committed by Sergey Mashkov
parent e2d663b288
commit e84aa78ac6
3 changed files with 10 additions and 4 deletions
+3
View File
@@ -29,3 +29,6 @@ native
public annotation class library(public val name: String = "")
native
public annotation class enumerable()
native
public annotation class marker
+2 -2
View File
@@ -5505,7 +5505,7 @@ native trait PseudoElement {
}
native trait CSS {
}
native trait UnionHTMLOptGroupElementOrHTMLOptionElement {
native marker trait UnionHTMLOptGroupElementOrHTMLOptionElement {
}
native trait UnionElementOrMouseEvent {
native marker trait UnionElementOrMouseEvent {
}
@@ -205,11 +205,14 @@ private fun <O : Appendable> O.renderFunction(allTypes: Set<String>, f: Generate
appendln(") : ${f.returnType.mapUnknownType(allTypes)} = noImpl")
}
fun <O : Appendable> O.render(allTypes: Map<String, GenerateTraitOrClass>, classesToUnions : Map<String, List<UnionType>>, iface: GenerateTraitOrClass) {
fun <O : Appendable> O.render(allTypes: Map<String, GenerateTraitOrClass>, classesToUnions : Map<String, List<UnionType>>, 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 : Appendable> O.render(ifaces: List<GenerateTraitOrClass>) {
}
unionTypeTraits.forEach {
render(all, emptyMap(), it)
render(all, emptyMap(), it, markerAnnotation = true)
}
}