data: fix `sizeof()` for Data
This commit is contained in:
parent
a2c7fb7d26
commit
3df63b9bf5
|
@ -49,6 +49,8 @@ class Data(Type[bytes]):
|
|||
return bytes(size)
|
||||
|
||||
def sizeof(self, context: Context, value: O[bytes]) -> O[Pos]:
|
||||
if value is not None:
|
||||
return len(value)
|
||||
return context.peek(self.size)
|
||||
|
||||
def __str__(self) -> str:
|
||||
|
|
Loading…
Reference in New Issue