JVM: support enumEntries intrinsic for Kotlin enums
Implementation is very similar to the `enumValues` intrinsic. Java enums and old (pre-1.9) Kotlin enums will be supported in a subsequent commit. #KT-59710
This commit is contained in:
committed by
Space Team
parent
c94c5a7d58
commit
874d1c514a
@@ -359,6 +359,16 @@ class ReifiedTypeInliner<KT : KotlinTypeMarker>(
|
||||
val desc = getSpecialEnumFunDescriptor(parameter, false)
|
||||
instructions.insert(insn, MethodInsnNode(Opcodes.INVOKESTATIC, parameter.internalName, "values", desc, false))
|
||||
return true
|
||||
} else if (next1.opcode == Opcodes.ACONST_NULL && next2.opcode == Opcodes.CHECKCAST) {
|
||||
instructions.remove(next1)
|
||||
instructions.remove(next2)
|
||||
// TODO: support enumEntries for Java enums.
|
||||
instructions.insert(
|
||||
insn, MethodInsnNode(
|
||||
Opcodes.INVOKESTATIC, parameter.internalName, "getEntries", Type.getMethodDescriptor(AsmTypes.ENUM_ENTRIES), false
|
||||
)
|
||||
)
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
|
||||
Reference in New Issue
Block a user