From e8f9f7d42a727600099e1512abf4cd246cbec6ad Mon Sep 17 00:00:00 2001 From: Phodal Huang Date: Sat, 6 Jan 2024 20:52:19 +0800 Subject: [PATCH] refactor: simplify code #24 --- .../src/main/kotlin/chapi/ast/cast/CFullIdentListener.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/chapi-ast-c/src/main/kotlin/chapi/ast/cast/CFullIdentListener.kt b/chapi-ast-c/src/main/kotlin/chapi/ast/cast/CFullIdentListener.kt index 4e01a4ab..2ef2ff7e 100644 --- a/chapi-ast-c/src/main/kotlin/chapi/ast/cast/CFullIdentListener.kt +++ b/chapi-ast-c/src/main/kotlin/chapi/ast/cast/CFullIdentListener.kt @@ -173,8 +173,8 @@ open class CFullIdentListener(fileName: String) : CAstBaseListener() { // handle for a pointer val firstParameter = currentFunction.Parameters[0] if (firstParameter.TypeType.endsWith('*')) { - val pointerIndex = firstParameter.TypeType.length - 1 - val baseType = firstParameter.TypeType.substring(0, pointerIndex) + val baseType = firstParameter.TypeType.removeSuffix("*") + structMap.getOrPut(baseType) { CodeDataStruct(NodeName = baseType) }.let {