diff --git a/chapi-ast-rust/src/main/kotlin/chapi/ast/rustast/RustAstBaseListener.kt b/chapi-ast-rust/src/main/kotlin/chapi/ast/rustast/RustAstBaseListener.kt index 45206969..2b0f49ea 100644 --- a/chapi-ast-rust/src/main/kotlin/chapi/ast/rustast/RustAstBaseListener.kt +++ b/chapi-ast-rust/src/main/kotlin/chapi/ast/rustast/RustAstBaseListener.kt @@ -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 { diff --git a/chapi-ast-rust/src/test/kotlin/chapi/ast/rustast/RustFullIdentListenerTest.kt b/chapi-ast-rust/src/test/kotlin/chapi/ast/rustast/RustFullIdentListenerTest.kt index 94945e1d..db9b546d 100644 --- a/chapi-ast-rust/src/test/kotlin/chapi/ast/rustast/RustFullIdentListenerTest.kt +++ b/chapi-ast-rust/src/test/kotlin/chapi/ast/rustast/RustFullIdentListenerTest.kt @@ -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}")