3535from typing import TYPE_CHECKING , Generic , Iterator , List , Optional , Tuple , TypeVar , Union , final
3636
3737from ...util .insertion_ordered_set import InsertionOrderedSet
38- from .complextypes import Enum , Struct
38+ from .complextypes import Enum
3939from .typing import CustomType , Type , UnknownType
4040
4141T = TypeVar ("T" )
@@ -165,8 +165,7 @@ def accept(self, visitor: DataflowObjectVisitorInterface[T]) -> T:
165165class Constant (Expression [DecompiledType ]):
166166 """Represents a constant expression type."""
167167
168- # python 3.12 allows writing: type ValueType = int | float | str | bytes | dict[str, ValueType]
169- ValueType = int | float | str | bytes | list ["ValueType" ] | dict [str , "ValueType" ]
168+ ValueType = int | float | str | bytes | Expression | list ["ValueType" ] | dict [int , "ValueType" ]
170169
171170 def __init__ (
172171 self ,
@@ -566,34 +565,3 @@ def copy(self) -> RegisterPair:
566565 def accept (self , visitor : DataflowObjectVisitorInterface [T ]) -> T :
567566 """Invoke the appropriate visitor for this Expression."""
568567 return visitor .visit_register_pair (self )
569-
570-
571- class StructConstant (Constant ):
572- """This class represents constant structs.
573- The value is a dictionary mapping offsets to the corresponding fields' value.
574- The vartype is a 'Struct' (a special ComplexType), which provides a mapping from offsets to field names."""
575-
576- def __init__ (self , value : dict [int , Expression ], vartype : Struct , tags : Optional [Tuple [Tag , ...]] = None ):
577- super ().__init__ (
578- value ,
579- vartype = vartype ,
580- tags = tags ,
581- )
582-
583- def __eq__ (self , __value ):
584- return isinstance (__value , StructConstant ) and super ().__eq__ (__value )
585-
586- def __hash__ (self ):
587- return hash (tuple (sorted (self .value .items ())))
588-
589- def __str__ (self ) -> str :
590- """Return a string representation of the struct"""
591-
592- return str (self .value )
593-
594- def __iter__ (self ) -> Iterator [Expression ]:
595- yield from self .value .values ()
596-
597- def copy (self ) -> StructConstant :
598- """Generate a copy of the UnknownExpression with the same message."""
599- return StructConstant (self .value , self ._type )
0 commit comments