fix(type): 内建短名可直接参与表达式类型转换

builtins 别名表优先于 builtins.vp 扫描,sizet(TB_VPCALL_MAX) 等调用恢复;stub 类型映射仅保留 CPtr 系列到 rawptr。
This commit is contained in:
TermiNexus committed 2026-10-18 14:35:43 +08:00
1 parent 94557ad2c0
commit 1f44d4291c
2 files changed
+5 -18

No files matched your search

-18
View File
@@ -22,24 +22,6 @@ _RE_LINE_COMMENT: re.Pattern[str] = re.compile(r'#.*$')
_STUB_TYPE_ALIASES: dict[str, str] = {
'CPtr': 'rawptr', 'CArrayPtr': 'rawptr', 'CAutoPtr': 'rawptr',
'CRef': 'rawptr', 'CTempRef': 'rawptr',
'CInt': 'int', 'CChar': 'char', 'CBool': 'bool', 'CVoid': 'void',
'CFloat': 'float', 'CDouble': 'double',
'CUnsignedChar': 'uchar', 'CUnsignedShort': 'ushort', 'CUnsignedInt': 'uint',
'CUnsignedLong': 'ulong', 'CUnsignedLongLong': 'ulonglong',
'CSignedChar': 'int8', 'CShort': 'short', 'CLong': 'long', 'CLongLong': 'longlong',
'CSizeT': 'sizet', 'CIntPtrT': 'int64', 'CUIntPtrT': 'uint64', 'CPtrDiffT': 'ptrdifft',
'CInt8T': 'int8', 'CInt16T': 'int16', 'CInt32T': 'int32', 'CInt64T': 'int64',
'CUInt8T': 'uint8', 'CUInt16T': 'uint16', 'CUInt32T': 'uint32', 'CUInt64T': 'uint64',
'CIntFast8T': 'intfast8', 'CIntFast16T': 'intfast16',
'CIntFast32T': 'intfast32', 'CIntFast64T': 'intfast64',
'CUIntFast8T': 'uintfast8', 'CUIntFast16T': 'uintfast16',
'CUIntFast32T': 'uintfast32', 'CUIntFast64T': 'uintfast64',
'CIntLeast8T': 'intleast8', 'CIntLeast16T': 'intleast16',
'CIntLeast32T': 'intleast32', 'CIntLeast64T': 'intleast64',
'CUIntLeast8T': 'uintleast8', 'CUIntLeast16T': 'uintleast16',
'CUIntLeast32T': 'uintleast32', 'CUIntLeast64T': 'uintleast64',
'CConst': 'const', 'CVolatile': 'volatile', 'CStatic': 'static',
'CExport': 'export', 'CExtern': 'extern', 'CInline': 'inline',
}
+5
View File
@@ -452,6 +452,11 @@ class TypeAnnotationResolver:
不再静默退化为 %"{mod}.{名}"* 假结构体(下游仅报 "Type of #N arg
mismatch: %…* != …",无法归因到 typedef 声明)。
"""
AliasClass: type | None = TypeSystem.BUILTIN_TYPE_ALIASES.get(TypeName)
if AliasClass is not None:
Info: CTypeInfo = CTypeInfo()
Info.BaseType = AliasClass
return Info
if not TypeName:
return None
if TypeName == cls._BUILTIN_ROWPTR_NAME: