Skip to content
This repository has been archived by the owner on May 25, 2022. It is now read-only.

Commit

Permalink
feat(bytecode): add return type support
Browse files Browse the repository at this point in the history
  • Loading branch information
phodal committed Mar 28, 2022
1 parent 0d36706 commit 270970a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,14 @@ class ByteCodeParser {

val isInterface: Boolean = CodeConstants.ACC_INTERFACE == methodNode.access
codeFunction.Modifiers = createModifiers(methodNode.access, METHOD_ALLOWED, isInterface, METHOD_EXCLUDED)
codeFunction.ReturnType = getReturnTypeFromDesc(methodNode.desc).orEmpty()

return codeFunction
}

private fun getReturnTypeFromDesc(desc: String): String? {
return Type.getType(desc).returnType.className
}

private fun getDataStructureName(internalName: String): String {
return Type.getObjectType(internalName).className
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ internal class ByteCodeParserTest {
assertEquals(2, ds.Functions.size)
assertEquals("<init>", ds.Functions[0].Name)
assertEquals("main", ds.Functions[1].Name)
assertEquals("void", ds.Functions[1].ReturnType)
}

@Test
Expand Down

0 comments on commit 270970a

Please sign in to comment.