将 EnumName/value/IsSigned 加入 FIELD_ROUTES,消除所有冗余 hasattr/getattr
This commit is contained in:
@@ -207,13 +207,13 @@ class StructGenMixin:
|
||||
is_packed = ClassName in self.class_packed
|
||||
if hasattr(self, 'SymbolTable') and self.SymbolTable and ClassName in self.SymbolTable:
|
||||
Entry = self.SymbolTable[ClassName]
|
||||
if hasattr(Entry, 'IsExceptionClass') and Entry.IsExceptionClass:
|
||||
if Entry.IsExceptionClass:
|
||||
continue
|
||||
if hasattr(Entry, 'IsEnum') and Entry.IsEnum:
|
||||
if not getattr(Entry, 'IsRenum', False):
|
||||
if Entry.IsEnum:
|
||||
if not Entry.IsRenum:
|
||||
continue
|
||||
if hasattr(Entry, 'IsTypedef') and Entry.IsTypedef:
|
||||
if hasattr(Entry, 'BaseType') and Entry.BaseType and not isinstance(Entry.BaseType, (type(None),)):
|
||||
if Entry.IsTypedef:
|
||||
if Entry.BaseType and not isinstance(Entry.BaseType, (type(None),)):
|
||||
import lib.includes.t as _t
|
||||
if not isinstance(Entry.BaseType, (_t._CTypedef,)):
|
||||
continue
|
||||
@@ -304,10 +304,10 @@ class StructGenMixin:
|
||||
for ClassName in all_classes:
|
||||
if hasattr(self, 'SymbolTable') and self.SymbolTable and ClassName in self.SymbolTable:
|
||||
Entry = self.SymbolTable[ClassName]
|
||||
if hasattr(Entry, 'IsExceptionClass') and Entry.IsExceptionClass:
|
||||
if Entry.IsExceptionClass:
|
||||
continue
|
||||
if hasattr(Entry, 'IsEnum') and Entry.IsEnum:
|
||||
if not getattr(Entry, 'IsRenum', False):
|
||||
if Entry.IsEnum:
|
||||
if not Entry.IsRenum:
|
||||
continue
|
||||
existing_st = self.structs.get(ClassName)
|
||||
if isinstance(existing_st, ir.IdentifiedStructType) and existing_st.elements is not None and len(existing_st.elements) > 0:
|
||||
|
||||
Reference in New Issue
Block a user