Skip to content

Commit

Permalink
feat(rust): make return type works
Browse files Browse the repository at this point in the history
  • Loading branch information
phodal committed Jan 1, 2024
1 parent ebeb903 commit 8132dc7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,8 @@ open class RustAstBaseListener(private val fileName: String) : RustParserBaseLis
}

open fun buildReturnType(functionReturnType: RustParser.FunctionReturnTypeContext?): String {
return functionReturnType?.type_()?.text ?: ""
val typeContext: Type_Context? = functionReturnType?.type_()
return lookupType(typeContext)
}

open fun buildParameters(functionParameters: RustParser.FunctionParametersContext?): List<CodeProperty> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ class RustFullIdentListenerTest {

val secondFunction = codeDataStruct.Functions[1]
assertEquals("main", secondFunction.Name)
// assertEquals("std::io::Result", secondFunction.ReturnType)
assertEquals("std::io::Result", secondFunction.ReturnType)
assertEquals(9, secondFunction.FunctionCalls.size)
secondFunction.FunctionCalls.map {
println("${it.NodeName} -> ${it.FunctionName} -> ${it.OriginNodeName}")
Expand Down

0 comments on commit 8132dc7

Please # to comment.