1212from libdestruct .common .obj import obj
1313
1414if TYPE_CHECKING :
15- from collections .abc import Generator , MutableSequence
15+ from collections .abc import Generator
1616
17+ from libdestruct .backing .resolver import Resolver
1718 from libdestruct .common .obj import obj
1819
1920
@@ -25,13 +26,12 @@ class array_impl(array):
2526
2627 def __init__ (
2728 self : array_impl ,
28- memory : MutableSequence ,
29- address : int | tuple [obj , int ],
29+ resolver : Resolver ,
3030 backing_type : obj ,
3131 count : int ,
3232 ) -> None :
3333 """Initialize the array."""
34- super ().__init__ (memory , address )
34+ super ().__init__ (resolver )
3535
3636 self .backing_type = backing_type
3737 self .count = count
@@ -59,10 +59,7 @@ def to_bytes(self: array_impl) -> bytes:
5959
6060 def __getitem__ (self : array_impl , index : int ) -> obj :
6161 """Get an item from the array."""
62- if self ._address :
63- return self .backing_type (self .memory , (self ._address , index * self .backing_type .size ))
64-
65- return self .backing_type (self .memory , (self ._reference , self ._offset + index * self .backing_type .size ))
62+ return self .backing_type (self .resolver .relative_from_own (index * self .backing_type .size , 0 ))
6663
6764 def __setitem__ (self : array_impl , index : int , value : obj ) -> None :
6865 """Set an item in the array."""
0 commit comments