(section_code, content_generator)
| 776 | } |
| 777 | |
| 778 | emit_section(section_code, content_generator) { |
| 779 | // Emit section name. |
| 780 | this.emit_u8(section_code); |
| 781 | // Emit the section to a temporary buffer: its full length isn't know yet. |
| 782 | const section = new Binary; |
| 783 | content_generator(section); |
| 784 | // Emit section length. |
| 785 | this.emit_u32v(section.length); |
| 786 | // Copy the temporary buffer. |
| 787 | // Avoid spread because {section} can be huge. |
| 788 | this.emit_bytes(section.trunc_buffer()); |
| 789 | } |
| 790 | } |
| 791 | |
| 792 | class WasmFunctionBuilder { |
no test coverage detected