Expose interop enum .value through CEnum interface

This commit is contained in:
Svyatoslav Scherbina
2017-03-27 19:58:45 +03:00
committed by SvyatoslavScherbina
parent 88a69015d8
commit a6b89e3a0d
2 changed files with 4 additions and 1 deletions
@@ -214,6 +214,9 @@ sealed class CPrimitiveVar : CVariable {
open class Type(size: Int) : CVariable.Type(size.toLong(), align = size)
}
interface CEnum {
val value: Number
}
abstract class CEnumVar : CPrimitiveVar()
// generics below are used for typedef support
@@ -612,7 +612,7 @@ class StubGenerator(
val baseTypeMirror = mirror(e.baseType)
block("enum class ${e.kotlinName.asSimpleName()}(val value: ${e.baseType.kotlinType})") {
block("enum class ${e.kotlinName.asSimpleName()}(override val value: ${e.baseType.kotlinType}) : CEnum") {
e.constants.forEach {
out("${it.name.asSimpleName()}(${it.value}),")
}