data: fix `sizeof()` for Data

This commit is contained in:
Shiz 2021-08-09 06:44:41 +02:00
parent a2c7fb7d26
commit 3df63b9bf5
1 changed files with 2 additions and 0 deletions

View File

@ -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: