Skip to content

Commit 99f122d

Browse files
committed
Fixed CastedPart not being visited when trying to cast void to another type and vice-versa
1 parent dc0b191 commit 99f122d

File tree

1 file changed

+5
-3
lines changed
  • src/main/kotlin/com/github/jonathanxd/codeapi/bytecode/gen/visitor

1 file changed

+5
-3
lines changed

src/main/kotlin/com/github/jonathanxd/codeapi/bytecode/gen/visitor/CastVisitor.kt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,13 @@ object CastVisitor : VoidVisitor<Cast, BytecodeClass, MVData> {
4949
val from = t.originalType
5050
val to = t.targetType
5151

52+
val castedPart = t.castedPart
53+
5254
// No cast of void types.
53-
if(from != null && !from.`is`(to) && from.`is`(Types.VOID) || to.`is`(Types.VOID))
55+
if(from != null && !from.`is`(to) && from.`is`(Types.VOID) || to.`is`(Types.VOID)) {
56+
visitorGenerator.generateTo(castedPart.javaClass, castedPart, extraData, null, additional)
5457
return
55-
56-
val castedPart = t.castedPart
58+
}
5759

5860
val autoboxing = if (from != null) autoboxing(from, to, castedPart) else null
5961

0 commit comments

Comments
 (0)