mirror of
https://github.com/JakeHillion/drgn.git
synced 2024-12-25 10:23:05 +00:00
program: convert value when creating rvalue
This is useful for a few cases: - We should make sure that the value of an object is actually valid for its type - When casting, the value should be converted to the new type where appropriate - For the upcoming ProgramObject operators
This commit is contained in:
parent
c3dbe939ad
commit
90f6913242
@ -66,6 +66,8 @@ class ProgramObject:
|
|||||||
self.address_ = address
|
self.address_ = address
|
||||||
self.type_ = type
|
self.type_ = type
|
||||||
self._real_type = type.real_type()
|
self._real_type = type.real_type()
|
||||||
|
if value is not None:
|
||||||
|
value = self._real_type.convert(value)
|
||||||
self._value = value
|
self._value = value
|
||||||
|
|
||||||
def __dir__(self) -> Iterable[str]:
|
def __dir__(self) -> Iterable[str]:
|
||||||
|
Loading…
Reference in New Issue
Block a user