Char-based enum shall be mapped to integer-based (#3621)
* Char-based enum shall be mapped to integer-basede * revised, using actual base type and Byte for constants of CharType * minor cleanup
This commit is contained in:
+6
-2
@@ -221,7 +221,11 @@ class StubsBuildingContextImpl(
|
||||
get() = stubIrContext.getKotlinName(this)
|
||||
|
||||
override fun tryCreateIntegralStub(type: Type, value: Long): IntegralConstantStub? {
|
||||
val integerType = type.unwrapTypedefs() as? IntegerType ?: return null
|
||||
val integerType = when (val unwrappedType = type.unwrapTypedefs()) {
|
||||
is IntegerType -> unwrappedType
|
||||
CharType -> IntegerType(1, true, "char")
|
||||
else -> return null
|
||||
}
|
||||
val size = integerType.size
|
||||
if (size != 1 && size != 2 && size != 4 && size != 8) return null
|
||||
return IntegralConstantStub(value, size, declarationMapper.isMappedToSigned(integerType))
|
||||
@@ -386,4 +390,4 @@ class StubIrBuilder(private val context: StubIrContext) {
|
||||
private fun generateStubsForObjCCategory(objCCategory: ObjCCategory) {
|
||||
addStubs(ObjCCategoryStubBuilder(buildingContext, objCCategory).build())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user