Lazily yield sections from the wasm file.
(self)
| 276 | self.buf.seek(count, os.SEEK_CUR) |
| 277 | |
| 278 | def sections(self): |
| 279 | """Lazily yield sections from the wasm file.""" |
| 280 | offset = HEADER_SIZE |
| 281 | while offset < self.size: |
| 282 | self.seek(offset) |
| 283 | section_type = SecType(self.read_byte()) |
| 284 | section_size = self.read_uleb() |
| 285 | section_offset = self.buf.tell() |
| 286 | name = None |
| 287 | if section_type == SecType.CUSTOM: |
| 288 | name = self.read_string() |
| 289 | |
| 290 | yield Section(section_type, section_size, section_offset, name) |
| 291 | offset = section_offset + section_size |
| 292 | |
| 293 | @memoize |
| 294 | def get_types(self): |