MCPcopy Create free account
hub / github.com/nodejs/node / emit_section

Method emit_section

test/fixtures/wpt/wasm/jsapi/wasm-module-builder.js:778–789  ·  view source on GitHub ↗
(section_code, content_generator)

Source from the content-addressed store, hash-verified

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
792class WasmFunctionBuilder {

Callers 1

toBufferMethod · 0.95

Calls 4

emit_u8Method · 0.95
emit_u32vMethod · 0.95
emit_bytesMethod · 0.95
trunc_bufferMethod · 0.95

Tested by

no test coverage detected