From 5157ce29968231a979e0068fe81f0f26829da4a1 Mon Sep 17 00:00:00 2001 From: TermiNexus Date: Sun, 18 Oct 2026 13:45:10 +0800 Subject: [PATCH] =?UTF-8?q?fix(symbol):=20=E8=A1=A5=E9=BD=90=E6=B3=9B?= =?UTF-8?q?=E5=9E=8B=E5=AE=9E=E5=8F=82=E5=BD=92=E4=B8=80=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E7=9A=84=E6=95=B4=E6=95=B0/=E6=B5=AE=E7=82=B9=E6=97=8F?= =?UTF-8?q?=E5=90=8D=E9=9B=86=E5=90=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit NormalizeGenericArgName 引用的 _GENERIC_ARG_INT_NAMES / _GENERIC_ARG_FLOAT_NAMES 此前未定义,导致 NameError;补充 C 类型类名与内建短名。 --- lib/core/SymbolUtils.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/lib/core/SymbolUtils.py b/lib/core/SymbolUtils.py index 8437833..e72be44 100644 --- a/lib/core/SymbolUtils.py +++ b/lib/core/SymbolUtils.py @@ -2712,6 +2712,33 @@ def IsPtrSubscriptNode(node: ast.AST, symtable: object | None = None, return IsCPtrMarkerNode(value, symtable, TCAliasMap) +_GENERIC_ARG_INT_NAMES: frozenset[str] = frozenset({ + 'CInt', 'CChar', 'CShort', 'CLong', 'CLongLong', + 'CUnsigned', 'CUnsignedChar', 'CUnsignedInt', 'CUnsignedShort', + 'CUnsignedLong', 'CUnsignedLongLong', 'CSignedChar', 'CBool', + 'CInt8T', 'CInt16T', 'CInt32T', 'CInt64T', + 'CUInt8T', 'CUInt16T', 'CUInt32T', 'CUInt64T', + 'CIntFast8T', 'CIntFast16T', 'CIntFast32T', 'CIntFast64T', + 'CUIntFast8T', 'CUIntFast16T', 'CUIntFast32T', 'CUIntFast64T', + 'CIntLeast8T', 'CIntLeast16T', 'CIntLeast32T', 'CIntLeast64T', + 'CUIntLeast8T', 'CUIntLeast16T', 'CUIntLeast32T', 'CUIntLeast64T', + 'CSizeT', 'CIntPtrT', 'CUIntPtrT', 'CPtrDiffT', + 'int8', 'int16', 'int32', 'int64', + 'uint8', 'uint16', 'uint32', 'uint64', + 'intfast8', 'intfast16', 'intfast32', 'intfast64', + 'uintfast8', 'uintfast16', 'uintfast32', 'uintfast64', + 'intleast8', 'intleast16', 'intleast32', 'intleast64', + 'uintleast8', 'uintleast16', 'uintleast32', 'uintleast64', + 'sizet', 'size_t', 'uchar', 'short', 'ushort', 'uint', + 'long', 'ulong', 'longlong', 'ulonglong', 'ptrdifft', +}) + +_GENERIC_ARG_FLOAT_NAMES: frozenset[str] = frozenset({ + 'CFloat', 'CDouble', 'CFloat8T', 'CFloat16T', + 'CFloat32T', 'CFloat64T', 'CFloat128T', +}) + + def NormalizeGenericArgName(NameId: str) -> str: """ast.Name 泛型实参 → 定义端 type_arg(HandlesExprCall._resolve_generic_slice_type 的 ast.Name 分支,逐分支同构):